Note that imports are subtley different than getattr behavior...

does your main main 'pypackage' package contain something like
the following in its __init__?

from subpackage import *

-Brian


On 7/31/07 9:22 PM, "Alberto Berti" <[EMAIL PROTECTED]> wrote:

> 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
> 
> _________________________________________________
> Python.NET mailing list - PythonDotNet@python.org
> http://mail.python.org/mailman/listinfo/pythondotnet

--------------------------
Brian Lloyd

[EMAIL PROTECTED]


_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet

Reply via email to