[IronPython] Cyclic Imports in Compiled Modules - Blocker
srivatsn at microsoft.com
Fri Sep 19 22:57:14 CEST 2008
Thanks Michael. I've filed both the issues a high pri bugs in Codeplex:
I'll let you know once they are fixed.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Friday, September 19, 2008 4:30 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Cyclic Imports in Compiled Modules - Blocker
Ok - minimal repro attached.
Inside the zip folder are two folders - "compiled" and "uncompiled".
Both have a 'test.py' script with an accompanying package.
'test.py' merely does 'import package.module1'.
The package contains 'module1.py' and 'module2.py' which print when they are first imported, and they import each other.
When you execute 'test.py' in the "uncompiled" folder with IronPython 2.0 B5 it outputs:
Imported package module 1
Imported package module 2
If you do the same in the "compiled" folder it cycles the 'Imported ...'
In order to get compiled packages working I added the following to the
from System.Reflection import Assembly
from System.IO import Path
this_dir = Path.GetDirectoryName(__file__)
ass = Assembly.LoadFile(Path.Combine(this_dir, 'modules.dll'))
As far as I can tell you need to do something like this in order to be able to import compiled modules from a package.
Michael Foord wrote:
> Hello guys,
> I've been attempting to create a binary distribution of Resolver One
> using clr.CompileModules with IronPython 2.0 Beta 5.
> The framework basically works - modulo the fact that subpackages in
> compiled assemblies don't work. However cyclic imports inside compiled
> modules don't work.
> We have some cyclic imports inside one of our packages. The code works
> under IronPython 2. I haven't yet attempted a minimal repro, *but*
> with prints inside the modules I can verify that the cyclic imports
> re-executes the prints in a cycle... never to escape.
> I'll attempt a minimal repro and repost here. This is going to block
> us on moving to IronPython 2 unfortunately.
> All the best,
More information about the Ironpython-users