带有[python3.6]的Httplib2无效语法错误

时间:2019-03-07 22:23:50

标签: python python-3.x httplib httplib2

很久以前,我使用python3构建应用程序。 不幸的是,这些天我的电脑坏了,我的ubuntu服务器发生了故障,不再使用了,所以我重新配置了它,并从github存储库中克隆了python应用程序,并以相同的步骤进行了部署,除了更新了一些依赖项。 然后我收到错误消息。 我知道这是有关python 2和python 3的兼容性问题。但是如何解决此问题?

[Thu Mar 07 16:07:12.139598 2019] [wsgi:error] [pid 10828:tid 139884947846912] [remote 99.230.56.77:63637]   File "/var/www/ItemCatalogApp/venv/lib/python3.6/site-packages/httplib2/__init__.py", line 462
[Thu Mar 07 16:07:12.139604 2019] [wsgi:error] [pid 10828:tid 139884947846912] [remote 99.230.56.77:63637]     print("%s:" % h, end=" ", file=self._fp)
[Thu Mar 07 16:07:12.139608 2019] [wsgi:error] [pid 10828:tid 139884947846912] [remote 99.230.56.77:63637]                         ^
[Thu Mar 07 16:07:12.139612 2019] [wsgi:error] [pid 10828:tid 139884947846912] [remote 99.230.56.77:63637] SyntaxError: invalid syntax

1 个答案:

答案 0 :(得分:0)

我怀疑您是在Python 2中而不是Python 3中运行此代码。

end=file=在Python 2中无效,除非程序顶部有from __future__ import print_function