[IronPython] second attempt: problem with import, packages, and IronPython 1.1
pierrejules.tremblay at gmail.com
Mon Feb 9 22:20:11 CET 2009
Hello IronPython team,
This did not seem to hit home with anyone, but I thought I'd try
again. We'd like to avoid having to upgrade to IronPython 2.0 unless
it's absolutely necessary.
Hopefully someone can point me to documentation that can help me solve
on my own? I haven't been able to find anything relevant.
We embedded IronPython 1.1 in our application. Unfortunately I am running
into problems accessing .NET assemblies in Python.
In one situation, if I create a module (let's call it mymodule.py) and put
it in sys.path, with the following code in it:
from System.Diagnostics import Process
p = Process()
and then send the IronPython interpreter a script that imports mymodule and
calls foo(), everything works fine:
p = mymodule.foo()
However, if mymodule.py is "packaged" in a subdirectory, let's say "subdir",
which is in the search path as well and has an empty __init__.py file,
p = subdir.mymodule.foo()
I get: "ImportError: can't find module named Diagnostics". It's as though
the fact that I've "packaged" the module in a directory breaks the way
IronPython gives me bindings to the .NET assemblies... Why should this
break? Am I doing something wrong?
More information about the Ironpython-users