Path ... where is my application's home dir?

Stano Paska Stanislav.Paska at kios.sk
Thu Apr 29 00:23:45 EDT 2004


Marco Aschwanden wrote:

> I want to store a file in the application directory. What is the easiest 
> way to figure out, where my application is situated?
> 
> sys.argv[0] does not work for my purposes... do you have any other ideas.
> 
> Thanks for any hint,
> Marco
> 
> 

I use this piece of code (on WinNT, WinXP):

import os, os.path
aaa = os.path.dirname(sys.argv[0])
if aaa == '':
     aaa = os.getcwd()
print "homedir is: " % aaa

Stano.






More information about the Python-list mailing list