【问题标题】:Creating files on AppEngine在 AppEngine 上创建文件
【发布时间】:2009-10-06 13:33:56
【问题描述】:

我正在尝试将一些数据存储在二进制文件中:

import os, pickle

o = some_object()
file = open('test', 'wb') #this causes the error
pickle.dump(o, file)
file.close()

我收到此错误:IOError: invalid mode: wb

它不起作用(无论是在测试服务器上还是在 GAE 本身上),显然是因为它没有写入权限。

如何在 Appengine 上创建文件?

【问题讨论】:

    标签: python google-app-engine file io


    【解决方案1】:

    GAE 是只读的,您只能将内容存储在数据存储区中

    here is a link to the docs

    【讨论】:

    • 这就是我害怕的。不过,感谢您节省了我的时间。 :)
    【解决方案2】:

    我认为简短的回答是您不应该这样做。我建议您将此信息作为 Blob 存储在 BigTable 中并以这种方式提供。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-13
      • 1970-01-01
      • 2019-06-19
      • 1970-01-01
      相关资源
      最近更新 更多