By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,104 Members | 672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,104 IT Pros & Developers. It's quick & easy.

os.getcwd gives me the wrong directory

Xx r3negade
P: 39
I have a script located in /home/jBrandt/Code/python/
When I print the results of os.getcwd(), however, it gives me /home/jBrandt/Code as the current working directory. I realize that I could change the cwd, but the directory name will not be the same on all computers. I've also tried os.curdir, and all it returns is a single dot (wtf?)

Anyway, I need a tried-and-true method for getting the cwd; any help would be appreciated.
May 24 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 849
The dot is a Unix/Linux shortcut that means current directory. Two dots means the parent directory to the current directory. As to the other the print call in a module being run from another script that is in the folder in question? It sounds like either that's the case or there's a hidden cd/os.chdir() call.
May 24 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.