[ python-Bugs-1250389 ] The -m option to python does not search zip files

SourceForge.net noreply at sourceforge.net
Tue Aug 2 18:55:26 CEST 2005


Bugs item #1250389, was opened at 2005-08-02 17:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1250389&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Paul Moore (pmoore)
Assigned to: Nobody/Anonymous (nobody)
Summary: The -m option to python does not search zip files

Initial Comment:
The -m option, to run a module from sys.path as a main 
program, does not work when the module is in a zip file. 
Here is an example demonstrating:

D:\Data>type zipmtest.py
def a():
    print "Hello, world"

if __name__ == '__main__':
    a()

D:\Data>python -m zipmtest
Hello, world

D:\Data>zip -9 zipm zipmtest.*
  adding: zipmtest.py (92 bytes security) (deflated 8%)

D:\Data>set PYTHONPATH=zipm.zip

D:\Data>del zipmtest.py
Deleting D:\Data\zipmtest.py
     1 file deleted

D:\Data>python -m zipmtest
python: module zipmtest not found

D:\Data>python -c "import zipmtest"

(note the last import - python can find the zipmtest 
module quite happily, but -m misses it).

This is a fairly severe limitation on -m, particularly as 
use of "egg" distributions (which are basically zipfiles) 
becomes more common.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1250389&group_id=5470


More information about the Python-bugs-list mailing list