Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to import python natural language processing toolkit nltk in node.js using node-python mentioned here: https://npmjs.org/package/node-python

The commands i am giving are similar as mentioned on the npm module site:

var python = require('node-python');
var os = python.import('os');

i am getting the following error:

Error: /usr/lib/python2.7/lib-dynload/datetime.so: undefined symbol: PyExc_SystemError
    at repl:1:25
    at REPLServer.self.eval (repl.js:109:21)
    at rli.on.self.bufferedCmd (repl.js:258:20)
    at REPLServer.self.eval (repl.js:116:5)
    at Interface.<anonymous> (repl.js:248:12)
    at Interface.EventEmitter.emit (events.js:96:17)
    at Interface._onLine (readline.js:200:10)
    at Interface._line (readline.js:518:8)
    at Interface._ttyWrite (readline.js:736:14)
    at ReadStream.onkeypress (readline.js:97:10)

I am using python2.7.2 After much search i found that this is a known bug in python2.7 and found a similar problem when importing from C here is the what i found: similar error found while importing python datetime module from C

The problem seems to be in the datetime.so module, i was thinking of getting the updated version of the datetime module and compiling it separately to make it work. I am still looking for that module and comple instructions. I would really appreciate If anyone has a better suggestion to resolve this or even help me locate the place to find this datetime module and its compile instructions. I really don't want to compile the whole python to make it work.

share|improve this question
    
Did you try updating the datetime module? I would like to use NLTK via node as well. –  bradodarb Dec 31 '13 at 16:06
1  
No, apparently you have to manually compile python to make it work, and i was not ready for that, a lot of other stuff is using my current python installation. I ended up making a small web service in python itself and used it with nodejs http module. here is the final thing: conterface.herokuapp.com –  vinit Dec 31 '13 at 18:18
    
Thanks, that sounds like a lot less pain than recompiling python std libs. I also considered using a AMQP layer (rabbitMQ, etc..) to connect things like NLTK or even StanfordNLP. Your app looks like it works well. –  bradodarb Jan 1 '14 at 16:02
    
I guess if you are building a high load system you may want to do that. Thanks for trying out the app. –  vinit Jan 1 '14 at 19:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.