py2exe windows apps path question

Gregory Piñero gregpinero at
Tue Aug 2 20:00:41 CEST 2005

Vincent, I'm not sure I completely understand your question but this
link may be the answer nonetheless:

And here is how I make sure I'm always using the right directory in my scripts:

Put this code at the top:
import sys
#print curdir
Then I use curdir to build all of the paths in my app:
For example let's get a list of files in a folder:
lstresumes=os.listdir(os.path.join(curdir,resume_folder_path)) #get
list of resumes

Below is optional but helps me keep a python module in the exe's main
directory and be able to edit it.  Otherwise the main module reads
from py2exe's lib file which seems harder to change:
sys.path.insert(0,curdir) #read from main dir, not library

Let me know if that helps (I may be answering the question I had
yesterday and not yours though ;-)


On 8/2/05, vincent wehren <vincent at> wrote:
> "Grant Edwards" <grante at> schrieb im Newsbeitrag
> news:11ev0tcg9n2ndd at
> |I have several python apps (some wxPython, some plain text-mode
> | stuff) that I distribute internally for installation on Win32
> | machines.  They're bundled/installed using py2exe and inno
> | setup.
> |
> | I followed what I think is the normal procedure of installing
> | each app in its own directory under /Program
> | Files/<vendor>/<app>.
> |
> | The problem is that the apps only run if they're started with
> | the install directory as the current working directory.
> | Otherwise they can't find the .dll's they use from the install
> | directory.
> AFAIK, Windows normally *does* search the directory where the executable
> module for the current process lives in for dlls. What sort of dlls are
> given you trouble?
> --
> Vincent Wehren
> |
> | Is there some way to temporarily add the app's install
> | directory to the search path for .dll's?
> |
> | --
> | Grant Edwards                   grante             Yow!  .. I think I'd
> |                                  at               better go back to my
> |                                 and toy with a few
> common
> |                                                   MISAPPREHENSIONS...
> --

Gregory Piñero
CEO and Founder
Blended Technologies

More information about the Python-list mailing list