将ReportLab与Google App Engine(Python)一起使用 - 在本地运行但在部署时失败

时间:2014-06-26 22:08:21

标签: python google-app-engine python-2.7 reportlab

我已成功部署了Google App Engine(Python)应用程序,并且我已经部署了多个版本而没有任何问题。我最近在本地开发的版本现在使用ReportLab生成PDF下载。这在本地工作正常,但是现在我已经尝试部署最新版本,我在日志中遇到以下内容时出现500错误:

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 239, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 298, in _LoadHandler
handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 84, in LoadObject
obj = __import__(path[0])
  File "/base/data/home/apps/s~tools/2-0.376834985709780158/main.py", line 12, in <module>
    import pdftools
  File "/base/data/home/apps/s~tools/2-0.376834985709780158/pdftools.py", line 1, in <module>
from reportlab.pdfgen import canvas
  File "/base/data/home/apps/s~tools/2-0.376834985709780158/reportlab/pdfgen/canvas.py", line 19, in <module>
from reportlab import rl_config
  File "/base/data/home/apps/s~tools/2-0.376834985709780158/reportlab/rl_config.py", line 122, in <module>
_startUp()
  File "/base/data/home/apps/s~tools/2-0.376834985709780158/reportlab/rl_config.py", line 92, in _startUp
if '~' in d: d = os.path.expanduser(d)
  File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/posixpath.py", line 268, in expanduser
    import pwd
ImportError: No module named pwd

我只是想知道是否有人可以解释为什么现在不能正常工作?

1 个答案:

答案 0 :(得分:0)

您的日志显示&#34; ImportError:没有名为pwd&#34;

的模块

你有pwd模块吗?

您可以通过尝试在交互式python shell中导入它来检查