importing packages from a zip file
Peter Tillotson
none at no.chance
Wed Jun 29 14:49:10 EDT 2005
More information about the Python-list mailing list
Wed Jun 29 14:49:10 EDT 2005
- Previous message (by thread): importing packages from a zip file
- Next message (by thread): urllib2, https, and proxies
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
cheers Scott should have been from myZip.zip import base.branch1.myModule.py and no it didn't work, anyone know a reason why this syntax is not preferred ?? sorry posted the soln again, it works but feels nasty Scott David Daniels wrote: > Peter Tillotson wrote: > >> ... With the file system >> >> base/ >> __init__.py >> branch1/ >> __init__.py >> myModule.py >> >> At the same time its possible to store modules in a flat zip-file and >> import modules with the following. >> >> > > > Does this work for you? It gives me a syntax error. > > Typically, put the zip file on the sys.path list, and import modules > and packages inside it. If you zip up the above structure, you can use: > > sys.path.insert(0, 'myZip.zip') > import base.branch1.myModule > > --Scott David Daniels > Scott.Daniels at Acm.Org
- Previous message (by thread): importing packages from a zip file
- Next message (by thread): urllib2, https, and proxies
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list