我想在我的应用引擎项目中使用Firebase。我已按照documentation中提到的说明使用第三方库。每当我尝试导入Firebase时:
from firebase import firebase
firebase = firebase.FirebaseApplication('ttps://myapp-c1367.firebaseio.com', None)
result = firebase.get('/users', None)
print result
它出现以下错误:
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
请帮忙。我在哪里做错了?
答案 0 :(得分:3)
错误是由firebase
软件包导入python的multiprocessing
软件包引起的,该软件包又会尝试导入subprocess
软件包。
Appengine标准运行时环境不允许导入subprocess
,因为Appengine上不允许后台进程。
如果您想在您的应用中使用Firebase,您可以使用REST API与其进行通信,或者将项目移至flexible environment或计算引擎上的自定义运行时。