0

我确定我做了一些愚蠢的事情,答案很简单,但我找不到它......我想在 GAE 上使用 pygal,所以我已经将整个pygal目录复制到我的lib目录中。然后,我导入它(从lib中的另一个文件):

import pygal

现在我得到:

Traceback (most recent call last):

  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle

    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())

  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler

    handler, path, err = LoadObject(self._handler)

  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject

    obj = __import__(path[0])

  File "main.py", line 18, in <module>

    from lib import output_lib

  File "lib\output_lib.py", line 14, in <module>

    import pygal

  File "lib\pygal\__init__.py", line 34, in <module>

    from pygal.graph.bar import Bar

ImportError: No module named pygal.graph.bar

我可以通过改变来解决这个问题

from pygal.graph.bar import Bar

pygal/__init__.py

from graph.bar import Bar

但这会导致错误的下一次迭代:

 ...

 File "lib\pygal\__init__.py", line 34, in <module>

   from graph.bar import Bar

 File "lib\pygal\graph\bar.py", line 27, in <module>

   from pygal.graph.graph import Graph

ImportError: No module named pygal.graph.graph

那么 - 这里有什么问题?

4

1 回答 1

0

为了获得更好的解决方案,我替换了所有文件的导入语句中所有出现的from pygal.*to from lib.pygal.*。它有效,但我仍然认为必须有另一种方法......

于 2015-08-31T20:22:19.803 回答