【发布时间】:2014-06-26 22:08:21
【问题描述】:
我成功部署了一个 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
我只是想知道是否有人可以解释为什么现在部署它不起作用?
【问题讨论】:
-
由于某种原因,reportlab 正在尝试导入 `pwd — 密码数据库`,这在 appengine 上不受支持/没有意义。您应该查看如何配置 reportlab 以在 appengine 上使用。由于某种原因,路径中使用了“~”。你需要弄清楚原因
-
本周已在 reportlab 中修复此问题,请尝试从他们的 repo 中查看:bitbucket.org/rptlab/reportlab/commits/…
-
非常感谢 Greg,问题已解决 - 非常感谢您的帮助!
标签: python google-app-engine python-2.7 reportlab