pythongoogle-app-engineapp-engine-patch

opening file: Writing is invalid mode


When executing:

path=os.path.dirname(__file__)+'/log.txt'
log=open(path,"w",encoding='utf-8')

I get:

log=open(path,'w',encoding='utf-8')
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1203, in __init__
raise IOError('invalid mode: %s' % mode)
IOError: invalid mode: w

I'm not sure why I can't write to the file?


Solution

  • App Engine's Python runtime supports Python 2.5 – newer versions of Python, including Python 2.6, are not currently supported. For security reasons, some Python modules written in C won't run in App Engine's sandbox. Because App Engine doesn't support writing to disk or opening direct network connections, other libraries that rely on this may not be fully usable.