py2exe windows apps path question
Gregory Piñero
gregpinero at gmail.com
Tue Aug 2 14:00:41 EDT 2005
Vincent, I'm not sure I completely understand your question but this
link may be the answer nonetheless:
http://www.jrsoftware.org/isfaq.php#workingdir
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
curdir=os.path.dirname(sys.argv[0])
#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 usersettings.py from main dir, not library
Let me know if that helps (I may be answering the question I had
yesterday and not yours though ;-)
-Greg
On 8/2/05, vincent wehren <vincent at visualtrans.de> wrote:
>
> "Grant Edwards" <grante at visi.com> schrieb im Newsbeitrag
> news:11ev0tcg9n2ndd at corp.supernews.com...
> |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
> DESK
> | visi.com and toy with a few
> common
> | MISAPPREHENSIONS...
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Gregory Piñero
CEO and Founder
Blended Technologies
(www.blendedtechnologies.com)
More information about the Python-list
mailing list