modules and generated code

Peter Otten __peter__ at web.de
Tue Nov 14 17:17:04 CET 2006


Nigel Rantor wrote:

> Peter Otten wrote:
>> Nigel Rantor wrote:

>>> So, if I have a tool that generates python code for me (in my case,
>>> CORBA stubs/skels) in a particular package is there a way of placing my
>>> own code under the same package hierarchy without all the code living in
>>> the same directory structure.

>> http://docs.python.org/lib/module-pkgutil.html

> Yep, looks like that should work, but it doesn't. :-/
> 
> Do you have any idea whether other __init__.py scripts from the same
> logical module will still be run in this case?

I don't think it will.

> The generated code uses its init script to pull in other code.

You could invoke it explicitly via 

execfile("/path/to/generated/package/__init__.py") 

in the static package/__init__.py.

Peter



More information about the Python-list mailing list