[Python-Dev] Inconsistent behaviour in import/zipimport hooks

Nick Coghlan ncoghlan at gmail.com
Thu Nov 10 10:11:50 CET 2005


Paul Moore wrote:
> On 11/9/05, Bob Ippolito <bob at redivi.com> wrote:
>> On Nov 9, 2005, at 1:48 PM, Thomas Heller wrote:
>>
>>> Bob Ippolito <bob at redivi.com> writes:
>>>
>>>> On Nov 9, 2005, at 1:22 PM, Bill Janssen wrote:
>>>>
>>>>> It's a shame that
>>>>>
>>>>> 1)  there's no equivalent of "java -jar", i.e., "python -z
>>>>> FILE.ZIP", and
>>>> This should work on a few platforms:
>>>> env PYTHONPATH=FILE.zip python -m some_module_in_the_zip
>>> It should, yes - but it doesn't: -m doesn't work with zipimport.
>> That's dumb, someone should fix that.  Is there a bug filed?
> 
> I did, a while ago. http://www.python.org/sf/1250389

Please consider looking at and commenting on PEP 328 - I got zero feedback 
when I wrote it, and basically assumed no-one else was bothered by the -m 
switch's fairly significant limitations (it went in close to the first Python 
2.4 alpha release, so we wanted to keep it simple).

The PEP and the associated patch currently only cover lifting the limitation 
against executing modules inside packages, but it should be possible to extend 
it to cover executing modules inside zip files as well (as you say, increasing 
use of eggs will only make the current limitations more annoying).

That discussion should probably happen on c.l.p, though. cc' me if you start 
one, and I can keep on eye on it through Google (I won't have time to 
participate actively, unfortunately :()

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.blogspot.com


More information about the Python-Dev mailing list