How to distribute code with required modules?

Jimmy Retzlaff jimmy at retzlaff.com
Sat Feb 2 11:43:23 EST 2002


>> I created a subdirectory of tools called pylib, and
>> check all my class modules into there.  Then I set by
>> PYTHONLIB environment variable to
>> "$HOME/sandbox/src/tools/pylib".

You could turn pylib into a package by placing an empty file inside of
it called '__init__.py'. Then, supposing RoysLib is a module, you could
simply change any occurrence of

import RoysLib

to

import pylib.RoysLib as RoysLib

and everything should work as before. You only need to make this change
in code appearing in "tools" and not to code appearing in "pylib".

Jimmy




More information about the Python-list mailing list