-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Description
from preprocessor import pad_vec_sequences, labels
from keras.models import load_model
import spacy
from preprocessor import nlp
import numpy as np
import sys
from dependency_tree import to_nltk_tree , to_spacy_desc
print('Hi')`
This code works when I run it from terminal. I have all the mentioned libraries installed. I'm using python 3.5.
I'm now trying to call this python file from python-shell in node-js . But I'm getting errors for the import statements saying import modules can't be found. I have made sure that python3.5 is used in both cases- from terminal and through nodeJs . The pythonPath I mentioned in options I got from sys.executable
app.post( '/api/message', function(req, res) {
PythonShell.run('demo.py', {
args: [req.body.input.text], pythonPath : '/usr/bin/python3'
} , function (err, results) {
console.log(results);
return res.json({
'input' : {
'text' : ''
},
'output': {
'text': results //+
//'<img src="http://localhost:8080/Finance/image1.jpg" class="imageclass">'
}
})
});
})
I don't understand why this is happening. There are no import errors when I run from terminal, but when I run from node-js I get import errors. numpy and sys are fine, the others are giving errors.
Metadata
Metadata
Assignees
Labels
No labels