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

Marco Aschwanden PPNTWIMBXFFC at spammotel.com
Wed Apr 28 10:15:56 EDT 2004


On Wed, 28 Apr 2004 14:44:30 +0100, Tim Golden 
<tim.golden at viacom-outdoor.co.uk> 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.
>
> a) Why doesn't argv[0] work?

Because I am stupid and tested always the old/unchanged version where the 
sys.argv had no impact. 8o((((
Thanks, your a) hint - it was the kick that I needed! The look over my 
shoulder!

But I still wonder: Suppose sys.argv[0] wouldn't work. What would be the 
easiest way to find out where an application lies?

Ideas:
1. going through sys.path and checking whether the application file is in 
a dir
2. or is there a module method, that tells you where it is stored?

Thanks for "help",
Marco





More information about the Python-list mailing list