Creating Zip file like java jar file

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Mar 1 12:21:05 EST 2009


En Sun, 01 Mar 2009 12:53:30 -0200, <zaheer.agadi at gmail.com> escribió:
> On Mar 1, 7:40 pm, zaheer.ag... at gmail.com wrote:
>> On Mar 1, 6:53 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
>> > En Sun, 01 Mar 2009 03:16:53 -0200, <zaheer.ag... at gmail.com> escribió:
>>
>> > >> >> >>> I want to create zip file equivalent to java jar file,I  
>> created a
>> > >> >> zip
>> > >> >> >>> file of my sources and added some __main__.py

>>   Thanks a lot Gabriel, yes this works fine when I am running it
>> outside of zip.
>> when I say  python __main__.py --uploadfile  it works fine
>> I dont know what happens when I zip it.
>>
>> And Steve: all of the packages have __init__.py inside them, I have
>> posted the tree structure of application if it helps.
>>
>> C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\DESKTOP\PYTHNSTUF
>> \TestApplication
>> ├───src
>> │   ├───network
>> │   │   ├───.svn
>> │   │   │   └───text-base
>> │   │   └───storage
>> │   │       └───.svn
>> │   │           └───text-base
>> │   ├───uc
>> │   │   └───some
>> │   │       └───extra
>> │   │           └───package
>> │   └───webdav
>> │       └───acp
>> └───test
>>     └───.svn
>>         └───text-base
>
> and also what it gives me when I Do, > python BRU.zip
> some list of files
> :
> :
> BRU/__init__.py                                2009-02-28
> 17:08:10          1
> BRU/__main__.py                                2009-03-01
> 18:17:20          8

So the __main__.py is recognized and runs. That's good news. But I see  
*another* __main__.py listed that should not exist, in a directory BRU.  
Are you sure you tested using the *outer* __main__.py? And what is that  
__init__.py?

Test in *another* directory, not your development environment, and remove  
all those extra artifacts like .svn directories and such that you're not  
going to deploy, I presume.

> Traceback (most recent call last):
>   File "C:\Python26\lib\runpy.py", line 121, in _run_module_as_main
>     "__main__", fname, loader, pkg_name)
>   File "C:\Python26\lib\runpy.py", line 34, in _run_code
>     exec code in run_globals
>   File "BRU.zip\__main__.py", line 18, in <module>
> ImportError: No module named network.storage

I see "network" inside "src" in your directory tree. For something like  
"ipmort network.storage" to work, "src" must be in the import path used by  
Python (sys.path).

> I appreciate your help Gabriella thanks  a lot,

My name is *Gabriel* and I'm male...

-- 
Gabriel Genellina




More information about the Python-list mailing list