[IronPython] Importing embedded .py files
JoeSox
joesox at gmail.com
Mon Jul 3 07:30:32 CEST 2006
What is the correct way to import an embedded module file(s) into a
PythonEngine?
In VS I have some embedded .py files which I have access to but I
can't seem to get the PythonEngine to import the modules. I don't
know if I am using the correct methods or not.
[embedded file: CNUDB.py in namespace ConceptNetUtils2]
...
public static PythonEngine cn_pe = new PythonEngine();
cn_pe.Execute("import sys");
Assembly CNUAssembly = Assembly.GetExecutingAssembly();
cn_pe.LoadAssembly(CNUAssembly);
cn_pe.Execute("import CNUDB"); //module CNUDB not found
...
If have also tried
cn_pe.Import("ConceptNetUtils2.CNUDB.py");
and
cn_pe.Import("clr");
cn_pe.Execute("clr.AddReference(\"ConceptNetUtils2.CNUDB.py\")");
IP exception:"Could not add reference to assembly ConceptNetUtils2.CNUDB.py"
any direction would be helpful. I'm sure I am over looking something. Thanks.
--
Later, Joe
More information about the Ironpython-users
mailing list