简体   繁体   中英

unable to connect firebase using python 3.72

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'

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:

  1. First run the command python3 -m pip show python-firebase .

  2. 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

  3. 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 :)

这仍然不起作用是否有一个干净的python-firebase版本我们可以安装它与python3.8一起使用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM