Reputation: 27
if anyone knows how to python 3.7 version connect with firebase. I 'm using the following code,
from firebase import firebase
firebase = firebase.FirebaseApplication('https://your_storage.firebaseio.com', None)
result = firebase.get('/users', None)
print (result)
it gave the following error ImportError: cannot import name 'firebase' from 'firebase'
Upvotes: 2
Views: 6874
Reputation: 862
I tried this and I too got an error while importing. From what I gather, python-firebase hasn't been updated to be fully compatible with python 3.7 or perhaps this is a rare issue.
What I found was that the firebase module actually had an error as it used python's protected keyword async
as a filename.
Here's what fixed the issue for me:
First run the command python3 -m pip show python-firebase
.
From there you should see a path to the pip folder. This could look like Location: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Navigate to that folder and find your "firebase" folder. Once in the folder, rename the async.py
file to something else, I renamed it to nasync.py
. Next you should open the __init__.py file and change the import declaration from from .async import process_pool
to from .nasync import process_pool
You also have to repeat this in the firebase.py
file.
Hope this helps :)
Upvotes: 13