user375348
user375348

Reputation: 789

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?

Upvotes: 1

Views: 869

Answers (2)

moraes
moraes

Reputation: 13629

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

Upvotes: 3

miku
miku

Reputation: 188124

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.

Upvotes: 3

Related Questions