Unable to save file in python

Posted by some1 on Stack Overflow See other posts from Stack Overflow or by some1
Published on 2013-11-03T21:49:53Z Indexed on 2013/11/03 21:54 UTC
Read the original article Hit count: 201

Filed under:
|

Trying to save files in python:

g = open('~/ccna_pages/'+filename, 'w')
g.write(page)
g.close()

Get this error:

Traceback (most recent call last): File "dl-pages.py", line 50, in g = open('~/ccna_pages/'+filename, 'w') IOError: [Errno 2] No such file or directory: '~/ccna_pages/1.0.1.1.html'

However, the directory does exist at that location.

This syntax seems to be the what the python docs recommend.. http://docs.python.org/release/1.5/tut/node46.html

What am I missing? Thanks..

© Stack Overflow or respective owner

Related posts about python

Related posts about file