【问题标题】:Can't write to a file using bottle with google app engine无法使用带有谷歌应用引擎的瓶子写入文件
【发布时间】:2013-05-28 11:11:45
【问题描述】:

我已经成功地在谷歌应用引擎中部署了我的 python 和瓶子框架应用程序,但是,我遇到了最奇怪的错误之一。

每当我尝试打开文件进行写入时,我都会收到错误消息,

Error: 500 Internal Server Error

Sorry, the requested URL 'http://issamcodemate.appspot.com/' caused an error:

Internal Server Error

当我在服务器端执行以下任何语句时,会发生这种情况,

f = open("Files/currentFile.txt",'r+') 
f = open("Files/currentFile.txt",'w') 
f = open("Files/currentFile.txt",'a') 

奇怪的是,当我执行这段代码时它工作正常,

f = open("Files/currentFile.txt",'r') 

但这只是为了阅读......

提前谢谢..

【问题讨论】:

  • 您是否有权以写入模式打开该文件?
  • 我猜它的权限,但这将如何解决?自托管
  • 我没用过GAE,但是试试看:os.chmod
  • 单独执行os.chmod也会出现同样的错误,可能还需要权限才能更改权限:)。它必须在设置中的某个位置才能为代码提供完全的管理员访问权限

标签: python google-app-engine web bottle


【解决方案1】:

您无法在 GAE 中写入本地文件系统。使用 blobstore 或 Google Cloud Storage。

【讨论】:

    猜你喜欢
    • 2020-11-05
    • 2012-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-20
    • 2017-05-31
    相关资源
    最近更新 更多