尝试导入时,httplib2语法错误无效

时间:2017-07-12 14:19:00

标签: python-2.7 apache-beam httplib2

我正在尝试设置apache-beam管道,并且在运行代码时出现以下错误

Traceback (most recent call last):
  File "C:/Users/Student/PycharmProjects/Event-Log/Event-Pipeline.py", line 5, in <module>
    import apache_beam as beam
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\apache_beam\__init__.py", line 78, in <module>
    from apache_beam import io
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\apache_beam\io\__init__.py", line 34, in <module>
    from apache_beam.io.gcp.bigquery import *
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\apache_beam\io\gcp\bigquery.py", line 114, in <module>
    from apache_beam.internal.gcp import auth
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\apache_beam\internal\gcp\auth.py", line 26, in <module>
    from oauth2client.client import GoogleCredentials
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\oauth2client\client.py", line 38, in <module>
    from oauth2client import transport
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\oauth2client\transport.py", line 17, in <module>
    import httplib2
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\httplib2\__init__.py", line 352
    print('%s:' % h, end=' ', file=self._fp)
                        ^
SyntaxError: invalid syntax

我根本没有在httplib2中编辑任何内容,当我查看该文件的代码时,它似乎应该是正确的,但出于奇怪的原因会出现几个预期的语句错误。它还表示在第一个打印行中,它不能指定文字。违规代码如下。

  for h, v in msg.items():
      print('%s:' % h, end=' ', file=self._fp)
      if isinstance(v, Header):
          print(v.encode(maxlinelen=self._maxheaderlen), file=self._fp)
      else:
          # Header's got lots of smarts, so use it.
          header = Header(v, maxlinelen=self._maxheaderlen, charset='utf-8',
                          header_name=h)
          print(header.encode(), file=self._fp)
  # A blank line always separates headers from body
  print(file=self._fp)

0 个答案:

没有答案