[Python.NET] embedding in aspx problem

Laurian Gridinoc laur at gd.ro
Mon May 17 07:47:48 EDT 2004


Hello,

I'm trying to figure out how can I use Python.NET, and I'm having weird
problems:

This run ok:

<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {

  PythonEngine.Initialize();
    
     PyObject p = PythonEngine.ImportModule("sys");
     PyObject c = p.GetAttr("path");
     

     string s = c.ToString();
     Response.Write(s);

     
     PythonEngine.Finalize();
}

</script>

It outputs:
['D:\\testsite\\bin\\python23.zip', '.\\DLLs', '.\\lib',
'.\\lib\\plat-win', '.\\lib\\lib-tk',
'\\\\?\\C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322']

But when I'm trying to run the script foo.py which is located under the
above '\lib' I'm getting "Exception of type
Python.Runtime.PythonException was thrown." at the line:

PyObject p = PythonEngine.ImportModule("foo");

How can I learn more about the exception cause?

Thank you,
-- 
Laurian Gridinoc
Chief Developer
GRAPEFRUIT DESIGN
www.grapefruitdesign.com




More information about the PythonDotNet mailing list