Accessing relative path in Python

Posted by Aaron Hoffman on Stack Overflow See other posts from Stack Overflow or by Aaron Hoffman
Published on 2010-06-01T22:28:02Z Indexed on 2010/06/01 22:33 UTC
Read the original article Hit count: 261

Filed under:
|

Hi, I'm running a Mac OS X environment and am used to using ~/ to provide the access to the current user's directory.

For example, in my python script I'm just trying to use

os.chdir("/Users/aaron/Desktop/testdir/")

But would like to use

os.chdir("~/Desktop/testdir/")

I'm getting a no such file or directory error when trying to run this. Any ideas?

© Stack Overflow or respective owner

Related posts about python

Related posts about path