[Python.NET] Packages are wrongly initialized?

Alberto Berti alberto at metapensiero.it
Wed Aug 1 03:22:46 CEST 2007


Hi all,

i'm in the process of embedding python in a C# application. After
initializing the engine, my application imports via (ImportModule) a
custom package which contains  the python side of my code. 

doing the following code raises an AttributeError Exception:

PyObject pypackage = PythonEngine.ImportModule('pypackage');
PyObject sub_module = pypackage.GetAttr('sub_module'); <-- raises the exception here

One other thing that isn't working is a non empty __init__.py inside
the package; trying to import any symbol defined in the __init__.py
also raises an AttributeError.

instead, this line works as expected:

PyObject pypackage = PythonEngine.ImportModule('pypackage.submodule');

I've tried the code with the old trunk and with the newer Christian's
one.

am I doing something wrong?
Anyone as any clue?

thanks in advance

Alberto



More information about the PythonDotNet mailing list