Is there any equivalent feature available in Python..?

Albert Hopkins marduk at letterboxes.org
Tue Feb 24 15:10:47 EST 2009


On Tue, 2009-02-24 at 11:05 -0800, zaheer.agadi at gmail.com wrote:
> Hi,
> 
> Is there any Python equivalent of java jar,can I include all my
> sources,properties file etc into a single file.Is there anyway in
> Python that I can run like the following
> 
> java  -jar Mytest.jar --startwebserver
> 
> How to so something like this in Python?

Similar but not equal:

$ tree mytest
mytest
|-- __init__.py
`-- main.py

$ cat mytest/__init__.py 
if __name__ == '__main__':
    import sys
    print sys.argv
    import mytest.main

$ cat mytest/main.py 
print 'hi mom'

$ zip -r mytest.zip mytest
  adding: mytest/ (stored 0%)
  adding: mytest/main.py (stored 0%)
  adding: mytest/__init__.py (deflated 4%)

$ PYTHONPATH=mytest.zip python -m mytest --startserver
[None, '--startserver']
hi mom






More information about the Python-list mailing list