On Sep 6, 10:19 am, rave247 rave247 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I' am unable to solve this problem. I've got python program, it is installed 
> in standard location. I run this program from some location X (note that I 
> just type relative "myscript", leaving operating system to look up script 
> itself using PATH variable) and this program somewhere in the code calls 
> os.chdir() to change it is current working directory and I would need in 
> python code to get the *original* directory location *after* os.chdir() is 
> performed. This means the location X from which script was performed - it is 
> the location I am in after script is finished.
>
> Thanks for any help


One of the best portable ones that I've seen used is this:

os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),'.'))

I've used it myself and it works for my needs.

Mike


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to