1

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?

user375348
  • 759
  • 1
  • 6
  • 23

2 Answers2

3

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.

miku
  • 181,842
  • 47
  • 306
  • 310
3

You can't write to disk in App Engine. At all. You must use datastore.

moraes
  • 13,213
  • 7
  • 45
  • 59