Re: importing packages from a zip file

2005-07-01 Thread Dieter Maurer
Scott David Daniels <[EMAIL PROTECTED]> writes on Wed, 29 Jun 2005 10:36:29 -0700: > Peter Tillotson wrote: > ... > > from myZip.zip import myModule.py > > > 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 packa

Re: importing packages from a zip file

2005-06-29 Thread Jp Calderone
On Wed, 29 Jun 2005 18:49:10 +, Peter Tillotson <[EMAIL PROTECTED]> wrote: >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 nas

Re: importing packages from a zip file

2005-06-29 Thread Peter Tillotson
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 >

Re: importing packages from a zip file

2005-06-29 Thread Peter Tillotson
solution: have to add the zip archives to the PYTHONPATH, can be done in the env but also as below import sys, os.path zipPackages=['base.zip'] for package in zipPackages: sys.path.insert(0,os.path.join(sys.path[0],package)) import base.branch1.myModule Peter Tillotson wrote: > Hi all, > >

Re: importing packages from a zip file

2005-06-29 Thread Scott David Daniels
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. > > from myZip.zip import myModule.py Does this work for yo

importing packages from a zip file

2005-06-29 Thread Peter Tillotson
Hi all, I was wondering if this is possible. In python v2.3 the import systems was extended via PEP302 to cope with packages. *.py files in a directory hierarchy can be imported as modules each level in the directory hierarchy needs to contain at least an empty __init__.py file. eg. With the file