Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4747

Re: Embedding Python's library as zip file

References <BANLkTikpNm0w9cjc=GUAC_oad1F900UAow@mail.gmail.com> <BANLkTinfTBgFe9dQ_2d0sAZLNjf_sPO8SA@mail.gmail.com> <BANLkTika=MCw67PCxrt6BTOeFgobcMN8EA@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2011-05-05 09:36 -0600
Subject Re: Embedding Python's library as zip file
Newsgroups comp.lang.python
Message-ID <mailman.1194.1304609831.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, May 5, 2011 at 4:55 AM, Wojtek Mamrak <tacyt1007@gmail.com> wrote:
> Thanks for the reply!
>
>> Can you import from zip files when running the Python.exe interpreter?
> When I zip the folder "Lib" into Python27.zip and later rename it and
> try to run the python.exe, I receive an error:
> "Import error: no module named site"

That means it's not finding it.  After startup, try adding the zip
file to your sys.path and then do "import site" at the command line,
and it should work.

>> Are you getting any sort of error message?
> When I run my app, it crashes while calling Py_Initialize(). The
> console closes suddenly.

Hm, that definitely seems odd.  What if you put the zip file in your
PYTHONPATH environment variable?

> Is it necessary to create zip archive using zipfile.PyZipFile?

It shouldn't be.  It works for me (at least with Python.exe) creating
the zip archive using 7-Zip.

Back to comp.lang.python | Previous | Next | Find similar


Thread

Re: Embedding Python's library as zip file Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-05 09:36 -0600

csiph-web