Click here to Skip to main content
15,886,680 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
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??
Posted
Updated 22-Mar-14 0:03am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900