[Python-Dev] zipimport, round 3 (or would that be that 37?)

Wiktor Sadowski Wiktor Sadowski" <art@wiktorsadowski.com
Sun, 8 Dec 2002 19:46:50 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_005D_01C29EF2.8D2854A0
Content-Type: text/plain;
	charset="windows-1250"
Content-Transfer-Encoding: quoted-printable

Just van Rossum <just@letterror.com> writes:

> I'll write a bit about the mechanics tomorrow, but in the meantime I =
would like
> to see some test results/bug reports/bug fixes from Windows =
developers. Please
> don't start with the full monty (ie. the std lib), try a small test =
archive
> first please ;-)

I have managed to apply the patch (import.c) to Python2.2.2 (wasn't too =
hard)

Could you please email me the site.py patch,or post it again?=20
>>>base64.decodestring(site.patch)
>>>binascii.Error: Incorrect padding

Python 2.2.2 (#37, Dec  7 2002, 19:19:43) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.

>>> import sys
>>> print sys.import_hooks
[<type 'zipimport.zipimporter'>]

>>> from PIL import Image
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in ?
    from PIL import Image
ImportError: No module named PIL

>>> sys.path.append('C:\Python22\PIL.zip')
>>> from PIL import Image
now it works

>>> from zipimport import zipimporter
>>> arc=3Dzipimporter('C:\Python22\Modules.zip')  #Modules.zip - zipped =
non-package directory
>>> m=3Darc.load_module('module1')
ok

>>> arc1=3Dzipimporter('C:\Python22\Modules.zip\Folder1')
>>> m=3Darc1.load_module('fmodule1')
ok


Regards
Wiktor
art@wiktorsadowski.com


------=_NextPart_000_005D_01C29EF2.8D2854A0
Content-Type: text/html;
	charset="windows-1250"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1250">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>Just van Rossum &lt;<A=20
href=3D"mailto:just@letterror.com">just@letterror.com</A>&gt; =
writes:</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&gt; I'll write a bit about the mechanics tomorrow, but in the =
meantime I=20
would like<BR>&gt; to see some test results/bug reports/bug fixes from =
Windows=20
developers. Please<BR>&gt; don't start with the full monty (ie. the std =
lib),=20
try a small test archive<BR>&gt; first please ;-)</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>I have managed to apply the&nbsp;patch (import.c) to Python2.2.2 =
(wasn't=20
too hard)</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>Could you please email me the site.py patch,or post it again?=20
<BR>&gt;&gt;&gt;base64.decodestring(site.patch)<BR>&gt;&gt;&gt;binascii.E=
rror:=20
Incorrect padding</DIV>
<DIV>&nbsp;</DIV>
<DIV>Python 2.2.2 (#37, Dec&nbsp; 7 2002, 19:19:43) [MSC 32 bit (Intel)] =
on=20
win32<BR>Type "copyright", "credits" or "license" for more=20
information.<BR><BR>&gt;&gt;&gt; import sys<BR>&gt;&gt;&gt; print=20
sys.import_hooks<BR>[&lt;type 'zipimport.zipimporter'&gt;]</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; from PIL import Image<BR>Traceback (most recent call=20
last):<BR>&nbsp; File "&lt;pyshell#2&gt;", line 1, in =
?<BR>&nbsp;&nbsp;&nbsp;=20
from PIL import Image<BR>ImportError: No module named PIL</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; sys.path.append('C:\Python22\PIL.zip')<BR>&gt;&gt;&gt; =
from=20
PIL import Image<BR>now it works</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; from zipimport import zipimporter<BR>&gt;&gt;&gt;=20
arc=3Dzipimporter('C:\Python22\Modules.zip')&nbsp; #Modules.zip - zipped =

non-package directory<BR>&gt;&gt;&gt; =
m=3Darc.load_module('module1')<BR>ok</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt;&gt;&gt;=20
arc1=3Dzipimporter('C:\Python22\Modules.zip\Folder1')<BR>&gt;&gt;&gt;=20
m=3Darc1.load_module('fmodule1')<BR>ok</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>Regards<BR>Wiktor<BR><A=20
href=3D"mailto:art@wiktorsadowski.com">art@wiktorsadowski.com</A><BR></DI=
V></BODY></HTML>

------=_NextPart_000_005D_01C29EF2.8D2854A0--