Hello im sai teja reddy
Problem : getting the error Message - No module named nltk while i was calling the python script with web service
Explanation :
I have a python script which returns data and calling this python script by creating a webservice i.e., i have integrated python and c# using ironpython and now the problem is i am successfully able to run the python code using command prompt and getting the correct output but when i'm calling through asmx it is throwing an error as below :
Message - No module named nltk Stack trace- at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value) at Microsoft.Scripting.Interpreter.FuncCallInstruction`2.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at CallAsmxViajQuery.AbbieCassService.SuggestedUtterances(String inputString)
My trails :
after googling a lot i got solutions like adding the sys.path. So after giving the correct path like
import sys
sys.path.append(r'C:\Python\lib\site-packages') #here is where my nltk module exists
sys.path.append(r'C:\Python\lib\site-packages\nltk')
sys.path.append(r'C:\Python\lib\site-packages\nltk\__init__.py')
it gave a new error like:
Message - No module named __future__ Stack trace- at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value).......
so i have imported __future__ and gave the below mentioned code to my python script :
sys.path.append(r'C:\Python\lib') #here is where my __future__ module exists
sys.path.append(r'C:\Python\lib\__future__.py')
Now i'm getting an issue like
Message - unexpected token 'from' Stack trace- at IronPython.Runtime.ThrowingErrorSink.Add................
Request : Can anyone exactly tell me how to import nltk using ironpython.Any help is accepted