【问题标题】:Trying to Import background_thread from google.appengine.api (like in example) fails with ImportError尝试从 google.appengine.api 导入 background_thread(如示例)失败并出现 ImportError
【发布时间】:2012-06-29 14:48:38
【问题描述】:

只是做...

from google.appengine.api import background_thread

...就像在official documentation 中一样,对我来说失败了...

<type 'exceptions.ImportError'>: cannot import name background_thread

...从我的后端调用它时。

如何正确导入?

【问题讨论】:

  • 您使用的是 Python 2.7 还是 Python 2.5 运行时?
  • Python 2.5... 我从1.6.4. release-notes 了解到这不仅仅是 Python 2.7?
  • 嗯;文档似乎并没有表明它只是 python2.7。另一方面,您的导入在 shell-27.appspot.com 上完美运行,而不是在 shell.appspot.com 上。

标签: python google-app-engine backend background-thread


【解决方案1】:

这是 Python 2.7 独有的功能。 SDK 也不支持。

【讨论】:

    【解决方案2】:

    它仅适用于 Python 2.7,并且在开发服务器中不受支持(正如 @Guido van Rossum 所说),当您将其上传到 GAE 服务器时

    【讨论】:

      猜你喜欢
      • 2015-09-24
      • 2013-12-14
      • 1970-01-01
      • 1970-01-01
      • 2019-01-11
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      相关资源
      最近更新 更多