httplib2 invalid syntax error when attempting to import

Viewed 629

I am attempting to set up an apache-beam pipeline and I keep getting the following error when I run my code

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

I haven't edited anything in httplib2 at all and when I look at the code for that file, it seems like it should be correct but several expected statement errors appear for odd reasons. It also indicates that the in the first print line, it can't assign a literal. The offending code is below.

  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 Answers
Related