[Ironpython-users] Distributing apps

mchalkley at mail.com mchalkley at mail.com
Mon Mar 5 20:56:16 CET 2012


Monday, March 5, 2012, 8:11:18 AM, you wrote:

> Sunday, March 4, 2012, 11:54:19 PM, you wrote:

>> On Sun, Mar 4, 2012 at 6:35 PM,  <mchalkley at mail.com> wrote:
>>> I have one more question regarding deploying python apps. If I put the
>>> python libraries I'm using (string, etc.) into a zip file, the app
>>> doesn't see it in the current working directory, for some reason.
>>> Since there's no PYTHONPATH on the target machine, and the 'os' module
>>> isn't available until after the library is imported, what's the best
>>> way to specify the path to the zipped lib file? I can specify a
>>> complete path, using sys.path.append (e.g. 'c:\lib.zip'), which
>>> requres putting it there, but is there a way specify the current
>>> working directory, so I can deploy the program in one place, rather
>>> than making the user copy the library to C:\ directory?

>> Does that work on CPython? If so, it's a bug, so please open an issue for it.

>> - Jeff

> Done - thanks!

> Mark

As slide_o_mix correctly pointed out, the behavior of IronPython's
import and directory handling are the same as CPython's.

For the benefit of others who want to do the same thing, this is what
worked for me:

import sys
sys.path.append('mymodules.zip')
import <whatever modules are in mymodules.zip that you want to import>

Done this way, the zip file can be located in the same directory as
the exe built with pyc.py.

Thanks for all the help,

Mark



More information about the Ironpython-users mailing list