Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old July 18th, 2005, 04:04 AM
Adrian Smith
Guest
 
Posts: n/a
Default Where? run directory

On a windows system.
I'm trying to get a Mcmillian created program to be 'independent' but
the first thing I need to do is find out where the program is being
run from, not the shortcut but the generated exe. This is where I keep
all the set-up files that I need to access.
Currently I have a fixed directory but don?t want to write anything
into the registry.
Is there a reg setting though that gives the address of the last run
program (presumably my program) or something like a working directory
setting.
I don?t want to have to search for the program through the directory
structure as that would be very time consuming.

Any Ideas out there would be very welcome
Thanks
  #2  
Old July 18th, 2005, 04:04 AM
Emile van Sebille
Guest
 
Posts: n/a
Default Re: Where? run directory


"Adrian Smith" asks,[color=blue]
> On a windows system.
> I'm trying to get a Mcmillian created program to be 'independent' but
> the first thing I need to do is find out where the program is being
> run from, not the shortcut but the generated exe. This is where I keep
> all the set-up files that I need to access.
> Currently I have a fixed directory but don?t want to write anything
> into the registry.
> Is there a reg setting though that gives the address of the last run
> program (presumably my program) or something like a working directory
> setting.
> I don?t want to have to search for the program through the directory
> structure as that would be very time consuming.
>[/color]

I think you're looking for:

import os
print os.path.dirname(__file__)


HTH,

Emile van Sebille
emile@fenx.com


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,338 network members.