3

I have used to below firebase blog link to execute a cron job on google cloud app engine for firebase functions but i am getting the below error.

Firebase Blog link

Please help..

22:47:33.468
 (/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py:263)
Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, 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 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/base/data/home/apps/s~updateroom-1a8fe/20170705t224250.402458509646721682/main.py", line 18, in <module>
    import pubsub_utils
  File "/base/data/home/apps/s~updateroom-1a8fe/20170705t224250.402458509646721682/pubsub_utils.py", line 23, in <module>
    import httplib2
  File "./lib/httplib2/__init__.py", line 352
    print('%s:' % h, end=' ', file=self._fp)
                        ^
SyntaxError: invalid syntax
Mohammed Rampurawala
  • 3,033
  • 2
  • 22
  • 32

1 Answers1

4

print('%s:' % h, end=' ', file=self._fp) is valid python3, but not valid python2.

You can either do a future import to use this syntax in python2:

from __future__ import print_function

or use the old print syntax.

UPDATE

Reviewing this, I noticed that the offending line of code is in library code: ./lib/httplib2/__init__.py

So the problem is that your httplib2 installation is the python3 version rather than the python2 version.

You can try reinstalling your vendored packages to fix this; the command will be

pip install -r <name-of-your-vendored-requirements-file> -t lib

Ensure that you are using the right version of pip: pip --version should point to a location within a python2 installation.

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153