On 7/12/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 10:09 AM 7/12/2007 +0200, Martin v. Löwis wrote: > >"" should not be removed from sys.path. It is *not* meant to be > >the current directory, but the directory where the main script > >lives. > > Right; it should be replaced with the zipfile path instead.
That's indeed what the current implementation does, replacing "" with the zip file. > I would personally rather see this option defined as simply placing a > directory at the front of sys.path, and perhaps defining a default -m > value of __main__, unless overrridden. Being able to use the option Actually, that's a good idea, and it does work with my current implementation [1], although we'd have to change the name __zipmain__. Is __main__ a good idea considering that is used for something similar but implemented completely differently (the module name)? I thought about using __main__, but decided on __zipmain__ since seemed to be more explicit and reduce potential conflicts. To be clear to other readers, the convention would be that if a __main__.py file exists at the root of a directory, then the whole directory is considered an executable python program. > more than once would be nice, too. On Windows, you can't set an > environment variable on the same line as a command, so this would > give you a one-liner way of setting sys.path and running an application. > > I do not see a reason to make this option zipfile-specific in any > way, though; it's just as useful (and sometimes more so) to be able > to distribute an application as a directory, since that lets you use > .pyd, .so, .dll etc. without needing the egg cache system for using those. Yes, the dynamic library importing is nice. thanks, Andy 1) andychu testprog$ find . ./__init__.py ./package1 ./package1/__init__.py ./package1/foo.py ./package1/lib.py ./__zipmain__.py andychu testprog$ ../python -z . lib module here argv: ['.'] andychu testprog$ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com