[py2exe] How can I specify additional module search paths

Thomas Heller thomas.heller at ion-tof.com
Thu Jan 31 11:14:48 EST 2002


"Ruediger Maehl" <ruediger.maehl_nospam at web.de> wrote in message news:newscache$wbmsqg$4ed$1 at www-neu.dzsh.de...
> Hello,
>
> I have just started to use py2exe (0.2.7) to build an executable,
> but some modules cannot be found. This is obvious, because
> sys.path gets an additional path during program execution.
>
> How can I include these modules then?
> Or better: how must the statement look like?

Ruediger,

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*)
- 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*.

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

Regards,

Thomas





More information about the Python-list mailing list