Module Name Conflicts
Peter Hansen
peter at engcorp.com
Thu Aug 18 20:49:48 EDT 2005
torched_smurf at yahoo.com wrote:
> Robert Kern wrote:
>>That doesn't work. The first module is recorded as 'cmd' in sys.modules
>>and gets reused on the second import.
>
> Exactly. And clearing sys.modules doesn't fix the problem. Once it's
> imported something from the first cmd package, it can no longer find
> anything in another cmd package; it will always look for it in that
> first package.
That part isn't correct. Removing the entry from sys.modules should
(and has, for me, in the past) worked fine to let a second import reload
a module, or find a new module after sys.path has been tweaked. Try it
again.
-Peter
More information about the Python-list
mailing list