[py2exe] How can I specify additional module search paths

Ruediger Maehl ruediger.maehl_nospam at web.de
Fri Feb 1 02:07:42 EST 2002


"Thomas Heller" <thomas.heller at ion-tof.com> schrieb im Newsbeitrag
news:a3bqhs$179dje$1 at ID-59885.news.dfncis.de...
>
> > [I am changing sys.path during program execution]
>
> the solution is simple: don't do that. Don't modify sys.path in your
program.
>
> There are several reasons:
> - It make it impossible for py2exe to find the modules you need (although
>   you *could* modify sys.path inside your setup-script *shudder*)

One of my solutions as preliminary workaround. The other was to
add the additional path to $PYTHONPATH for py2exe's execution time.

> - Even if py2exe would find your modules, the frozen executable would not,
>   at least not in the way you would expect. The frozen executable runs
>   with an empty sys.path [], but finds the modules via an installed import
>   hook, which is searched first.
>   Modifying the path now would instruct the executable to additionally
search
>   for modules or packages in the *file system*.

Yes, that does not work.

> Why do you want to modify the sys.path in your program?

Because I have a library directory for each application package, that
contains only application relevant modules.

Now that I found py2exe will work for me (upto now, at least),
I must perhaps consider a different approach.
Btw, any problems with the reportlab package?

Where do _you_ place application specific modules?
Or do you include all these directories in $PYTHONPATH?

Many regards,

Rüdiger





More information about the Python-list mailing list