"Gabriele *Darkbard* Farina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I have a zip file structured like this: > > mymodule.zip\ > module1.py > submodule\ > submodule1.py > > I tried to load submodule.submodule1 using this pice of code: > > import zipimport > > z = zipimport.zipimporter("mymodule.zip") > z.load_module("submodule.submodule1") > > but it does not work (load_module raises an exception) > > why?
try z.load_module("submodule/submodule1") instead. Or in otherwords replace the dot with a slash, now quoting from the docs "'fullname' must be the fully qualified (dotted) module name.". The dotted part of that doesn't seem to be correct, at least with the version of python (2.3.4) I'm running. Anyway personally I find: import sys sys.path.insert(0, 'mymodule.zip') import submodule.submodule1 a much cleaner way of thinking about this. -- Jonathan -- http://mail.python.org/mailman/listinfo/python-list