Possible Duplicate:
How to get/set logical directory path in python
I have a Python script that I run from a symlinked directory, and I call os.getcwd() in it, expecting to get the symlinked path I ran it from. Instead it gives me the "real" path, and in this case that's not helpful. I need it to actually give me the symlinked version.
Does Python have a command for that?
getcwd() method is used to get the current working directory of a process. Somewhere in your script, you can add this function anytime you wish to know or get the directory of an operation currently being carried out.
os. getcwd() method tells us the location of current working directory (CWD). Parameter: No parameter is required. Return Value: This method returns a string which represents the current working directory.
Workaround: os.getenv('PWD')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With