[IronPython] Compilation difficulties

William Reade william at resolversystems.com
Fri Sep 29 14:26:53 CEST 2006


Hi all

I've been playing with the (excellent) Pyc sample, and I've got stuck. I 
have a series of files a bit like the following:

project/
| main.py
+ Cheesemonger/
  | Shopkeeper.py
  | Counter.py

...in which main.py contains statements like:

from Cheesemonger.Counter import Counter

...and Counter.py also contains statements like:

from Cheesemonger.Shopkeeper import Shopkeeper

---

This is all very well, but I can't work out how to compile a 
Cheesemonger.dll in which the above imports still function -- when I 
inspect it with ildasm, the dll contains "Counter" and "Shopkeeper" 
rather than "Cheesemonger.Counter" and "Cheesemonger.Shopkeeper".

I can "fix" the issue by undisambiguating the imports:

clr.AddReference("Cheesemonger")
from Counter import Counter

...and:

from Shopkeeper import Shopkeeper

...but we've been burned by ambiguous imports before and would prefer 
not to reintroduce them (life can get confusing when every directory 
contains its own "UnitTests" directory ;)).

Is there any way of compiling a directory (and subdirectories) into a 
single dll, such that no import statements need to be changed? A quick 
look at the IP source left me none the wiser, I'm afraid.

Cheers
William




More information about the Ironpython-users mailing list