I have written the following code and I am getting no module named fcntl
when i am running the python script using C#
print "hi how are you"
import nltk
a="hi how are you"
tokens=nltk.word_tokenize(a)
print tokens
I have written the following code and I am getting no module named fcntl
when i am running the python script using C#
print "hi how are you"
import nltk
a="hi how are you"
tokens=nltk.word_tokenize(a)
print tokens
Possibly NLTK depends on subprocess module, which is not supported in embedded IronPython. There're already some answers on the subject:
Also check your sys.path
. Probably it is not set automatically for embedded engine. You can set library paths like this:
engine.SetSearchPaths(
new string[]
{
"C:\\Program Files\\IronPython 2.7",
"C:\\Program Files\\IronPython 2.7\\Lib",
"C:\\Program Files\\IronPython 2.7\\Lib\\site-packages",
}
);
Any module, dependent on fcntl
, decides to import it only if sys.platform == 'posix'
. Debug it's actual value inside your python code and try to force it to "win32"
(before any other imports)
import sys
sys.platform = "win32"