importing module as filename
Peter Otten
__peter__ at web.de
Tue Nov 11 03:02:05 EST 2003
david farning wrote:
> I am having a problem with name space contention.
> I am combining two existing programs both with their own config
> modules.
>
> I have been expermenting with
> import config #grab first config
> sys.path.insert(0,"/usr/share/yum/")
> import config as yconfig #grab second config
>
>
> The first config always seems to squash the second config.
> There should be a yconfig.yumconf but there is not.
>
> any suggestions?
How about a symlink to disambiguate the module names,
e. g. ln -s config.py yumconfig.py, and then
import config, yumconfig
Somewhat more ambitious: convert the program directory into a package by
adding an __init__.py script and then
import config, yum.config
Peter
More information about the Python-list
mailing list