[Fwd: modules and generated code]

Nigel Rantor wiggly at wiggly.org
Mon Dec 18 14:25:24 GMT 2006


Forwarded to l.pm, completely OT, just wondering if I get a better 
response here than the python list it was originally sent to.

Blame lathos on IRC, he said I should.

   n

-------- Original Message --------
Subject: modules and generated code
Date: Tue, 14 Nov 2006 14:20:07 +0000
From: Nigel Rantor <wiggly at wiggly.org>
To: python-list at python.org


Hi all,

Python newbie here with what I hope is a blindingly obvious question
that I simply can't find the answer for in the documentation.

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.

Ideally I would like something like the following:

package_dir/
	top_level_package/
		generated_code_package/
		implementation_code_package/

but have two distinct directories that hold them so that I can simply
delete the generated code and regenerate it without worrying that
anything got left behind.

So, I want something like:

generated_package_dir/
	top_level_package/
		generated_code_package/

implementation_package_dir/
	top_level_package/
		implementation_code_package/

Whilst I can create this structure, and add 'generated_package_dir' and
'implementation_package_dir' to PYTHONPATH the fact that both
directories contain 'top_level_package' seems to be causing clashes,
perhaps because there are multiple __init__.py files for
'top_level_package'?

I know that this is possible in Java, Perl and C++ so I am finding it
hard to believe I can't do the same in Python, I just think I'm too new
to know how.

I have spent most of this morning searching through all the docs I can
find, searching on USENET and the web to no avail.

Any help or pointers greatly appreciated.

Regards,

   n



More information about the london.pm mailing list