Search code examples
pythongoogle-app-enginefirebasewebapp2

Webapp2 Google App Engine Firebase import error


I want to use Firebase in my app engine project. I have followed the instructions mentioned in the documentation for using the third party libraries. Whenever I try to import Firebase:

from firebase import firebase
firebase = firebase.FirebaseApplication('ttps://myapp-c1367.firebaseio.com', None)
result = firebase.get('/users', None)
print result

It gives the following error:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "C:\Users\shaizi\PycharmProjects\simpletestapp - MVC\controllers\Handlers.py", line 24, in dispatch
    webapp2.RequestHandler.dispatch(self)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "C:\Users\shaizi\PycharmProjects\simpletestapp - MVC\controllers\Login.py", line 45, in get
    from firebase import firebase
  File "C:\Users\shaizi\PycharmProjects\simpletestapp - MVC\lib\firebase\__init__.py", line 3, in <module>
    from .async import process_pool
  File "C:\Users\shaizi\PycharmProjects\simpletestapp - MVC\lib\firebase\async.py", line 1, in <module>
    import multiprocessing
  File "C:\Python27\Lib\multiprocessing\__init__.py", line 65, in <module>
    from multiprocessing.util import SUBDEBUG, SUBWARNING
  File "C:\Python27\Lib\multiprocessing\util.py", line 41, in <module>
    from subprocess import _args_from_interpreter_flags
ImportError: cannot import name _args_from_interpreter_flags

Please help. Where am I doing a mistake?


Solution

  • The error is caused by the firebase package importing python's multiprocessing package, which is in turn trying to import the subprocess package.

    The Appengine standard runtime environment does not allow subprocess to be imported, as background processes are not allowed on Appengine.

    If you want to use Firebase with your app you will have you communicate with it using the REST API, or move your project to a flexible environment or a custom runtime on Compute Engine.