py2exe and dynamic modules

Uwe C. Schroeder uwe at
Mon Jun 9 20:45:14 CEST 2003


I checked everything and it seems I'm the only one trying to do this.
I have a large application that dynamically loads plugins.
There is no way I can say at runtime what names the plugins have, so loading
them statically is not an option. 
The plugins are quite simple and contain one class only.
With a full python installation it's no problem to load them using
__import__. However in a py2exe deployment the importer is replaced, so
__import__ won't work anymore.
Also the directory where the plugins are stored is user dependant (on
windows in the profile tree) and is determined at runtime. The plugins
don't even exist at application start, they are transfered on request.

What I can say is that for one user the directory is always the same.
Is there a way to deploy this using py2exe (or whatever, although I like
py2exe for it's simplicity) ?

I can modify the program to store the plugins in a fixed place - but I don't
like this too much since then deploying it on *nix is a hassle for access
right reasons.

Is there any way to tell py2exe's importer to look in a certain directory ?
as said: currently I just add the directory to sys.path and do an

Any hints ?



Open Source Solutions 4U, LLC   2570 Fleetwood Drive
Phone:  +1 650 872 2425         San Bruno, CA 94066
Cell:   +1 650 302 2405         United States
Fax:    +1 650 872 2417

More information about the Python-list mailing list