gpt4 book ai didi

python - 无法导入ndb

转载 作者:行者123 更新时间:2023-11-30 23:44:25 26 4
gpt4 key购买 nike

我刚刚接触了 Google App Engine。我加入了一个项目,但不知道它是如何工作的,所以如果这个问题看起来很愚蠢,我很抱歉。

我的问题是,查看日志,它说无法导入ndb。我查了一下,发现默认情况下应该出现在 1.6.4 版本的 google 应用引擎中。

我尝试从控制台导入它,但它也不起作用。我安装的 python 和谷歌应用程序引擎都很干净,我今天都安装了。

我该怎么办?

我正在使用 python 2.7 和 google app engine 1.6.4 在 Windows 上工作。

这是给我带来问题的代码行:

from wtforms.ext.appengine.ndb import model_form

这是错误:

INFO 2012-04-10 19:44:34,582 dev_appserver.py:2884] "GET / HTTP/1.1" 500 - ERROR 2012-04-10 19:47:05,239 wsgi.py:189] Traceback (most recent call last): File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 187, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 236, in _LoadHandler import(cumulative_path) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1850, in load_module return self.FindAndLoadModule(submodule, fullname, search_path) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1722, in FindAndLoadModule description) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1665, in LoadModuleRestricted description) File "C:\Users\chobeat\workspace\pappa Mi\py\main.py", line 38, in from py.comments import * File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1850, in load_module return self.FindAndLoadModule(submodule, fullname, search_path) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1722, in FindAndLoadModule description) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1665, in LoadModuleRestricted description) File "C:\Users\chobeat\workspace\pappa Mi\py\comments.py", line 20, in from py.form import IspezioneForm, NonconformitaForm, DietaForm, NotaForm File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1850, in load_module return self.FindAndLoadModule(submodule, fullname, search_path) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1722, in FindAndLoadModule description) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1665, in LoadModuleRestricted description) File "C:\Users\chobeat\workspace\pappa Mi\py\form.py", line 6, in from wtforms.ext.appengine.ndb import model_form ImportError: No module named ndb

最佳答案

您需要像这样导入它:

从 google.appengine.ext 导入 ndb

如果您只是说import ndb,您就会错过一些导入路径信息。不要害怕将有问题的代码复制到您的问题中。通常,这将提供重要的线索。

更新:WTForms 不包含在 AppEngine SDK 中。您需要 install it在您的系统上。

关于python - 无法导入ndb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10095059/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com