0
谷歌應用程序引擎是否不支持umask?我可以在windows的anaconda中使用它,但是當我在谷歌應用程序引擎(在本地運行)中嘗試它時,它不起作用。爲什麼谷歌應用程序引擎告訴我,umask沒有在Windows上的python實現?
此代碼:
import webapp2
import os
class MainHandler(webapp2.RequestHandler):
def get(self):
mask = os.umask(0o177)
self.response.write(mask)
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
給了我以下錯誤:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Users\Dan\Documents\Apps\test\main.py", line 22, in get
mask = os.umask(0o177)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\stubs.py", line 40, in os_error_not_implemented
raise OSError(errno.ENOSYS, 'Function not implemented')
OSError: [Errno 40] Function not implemented
我最後一次檢查,它沒有。 GAE暴露一個非常手動的環境,你不應該在那裏做文件I/O。如果你需要這個,可以在GCE上獲得真正的VPS。 –