Getting original working directory

Gary Herron gherron at islandtraining.com
Thu Sep 6 14:32:51 EDT 2007


rave247 rave247 wrote:
> "......the *original* directory location *after* os.chdir() is performed......" os.getcwd() is not helping much as it returns the location that was set up in os.chdir() call
>   
That requirement is just to absurd to be taken at face value.  Are you
saying you *CAN'T* call getcwd and save the value before you call chdir,
and that you *MUST* recover the original working directory *AFTER* you
change it.  I don't believe it... and won't waste my time trying to
solve such a silly problem until you demonstrate that you can't do it
any other way.

Gary Herron

> Thanks
>
>
>   
>> ------------ Původní zpráva ------------
>> Od: Gabriel Genellina <gagsl-py2 at yahoo.com.ar>
>> Předmět: Re: Getting original working directory
>> Datum: 06.9.2007 17:35:51
>> ----------------------------------------
>> On 6 sep, 12:19, rave247 rave247 <rave... at seznam.cz> wrote:
>>
>>     
>>> 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.
>>
>> Use os.getcwd()
>> http://docs.python.org/lib/os-file-dir.html
>>
>> --
>> Gabriel Genellina
>>
>> -- 
>> http://mail.python.org/mailman/listinfo/python-list
>>
>>
>>
>>     





More information about the Python-list mailing list