I'm adding python script in my website which i'm using it for serial communication and to do so i'm using ironpython...
Following is the Codebehind file of my webpage:--
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
using Microsoft.Scripting;
using IronPython.Runtime;
public partial class _Default : System.Web.UI.Page
{
static ScriptEngine engine = Python.CreateEngine();
ScriptScope pyScope = engine.CreateScope();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
ScriptEngine pyEngine = Python.CreateEngine();
pyEngine.ExecuteFile(@"D:\project\App_8th Sem\FinalDesign v0.3\scan.py");//error here
}
catch (Exception eo)
{
Label1.Text = "err ==" + eo;
}
}
}
Scan.py file:==
import serial
print 'hello... '
so when i click on button it gives me python runtime exception as below :--
"
IronPython.Runtime.Exceptions.ImportException: No module named serial 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 IronPython.Compiler.PythonScriptCode.Run(Scope scope) at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at Microsoft.Scripting.Hosting.ScriptEngine.ExecuteFile(String path) at _Default.Button1_Click(Object sender, EventArgs e) in d:\project\App_8th Sem\FinalDesign v0.3\admDefault.aspx.cs:line 37
"
and i also installed pyserial on my pc..
so am i missing some kind of reference dll or what??
解决方案