Creating Zip file like java jar file

rdmurray at bitdance.com rdmurray at bitdance.com
Sat Feb 28 15:46:42 EST 2009


zaheer.agadi at gmail.com wrote:
> On Feb 28, 11:33 pm, Lie Ryan <lie.1... at gmail.com> wrote:
> > zaheer.ag... at gmail.com wrote:
> > > On Feb 28, 11:15 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
> > > wrote:
> > >> En Sat, 28 Feb 2009 14:34:15 -0200, <zaheer.ag... at gmail.com> escribi=
> =F3:
> >
> > >>> I want to create zip file equivalent to java jar file,I created a zip
> > >>> file of my sources and added some __main__.py
> > >>> it says __Main__.py not found in Copyproject.zip..?
> > >> __main__.py must exist in the root directory.
> >
> > >> --
> > >> Gabriel Genellina
> >
> > > What do you mean by root directory..?What is this directory in
> > > Windows..?You mean the top level folder of the project?in my case
> > > copyproject folder..?
> >
> > root directory is the topmost directory (imagine a tree, the root is
> > where all the branches branched from), in this case the root directory
> > is your copyproject main folder.
> 
> 
> I wonder, I do have the __main__.py  in the root directory,but still getting
> python.exe cannot find __main__.py in CopyProject.zip
> 
> I used the following command
> python Copyproject.zip -m __main__.py --uploadFile and also tried with
> python Copyproject.zip --uploadFile
> both give me the same error , I can see the sys.path contains the
> project folder.

How did you create the zip?  The __main__.py file has to be at the
_top level_ of the zip file.  In other words:

    zip test.zip __main.py othermodule.py somedir

works but

    zip test.zip myproject

does not.

--RDM




More information about the Python-list mailing list