I’m trying to open a file that doesn’t exist with this line:
x = open("~/tweetly/auth", 'w+')
That should open it if it exists, and then wipe content to begin to write.
If it doesn’t exist, it should create it…right?
It doesn’t. I get this error.
IOError: [Errno 2] No such file or directory: '~/tweetly/auth'
Ideas?
The
~alias for the home directory is a shell-ism (something the shell does for you), not something you can use with the Pythonopencommand: