Receiving .async error when trying to import the firebase package

17,214

Solution 1

The problem is that async is a keyword in python 3.7 the solution is quite simple.

Just rename the file async.py to something other like asyncn.py and replace every from .async import process_pool in the files firebase.py , decorators.py and others , to from .asyncn import process_pool

Edit:

Also it might still persist so change it from init.py file

Solution 2

The issue was fixed here here. For some reason, the working python-firebase package did not make it to PyPI.

In order to fix it, pip install the latest version manually:

pip install git+https://github.com/ozgur/python-firebase

If you need a static version of the library, you could use the commit hash. For example:

pip install \
    git+https://github.com/ozgur/python-firebase@0d79d7609844569ea1cec4ac71cb9038e834c355
Share:
17,214
S. Hajela
Author by

S. Hajela

Updated on June 18, 2022

Comments

  • S. Hajela
    S. Hajela about 2 years

    I'm trying to write a python script that requires a connection to firebase. I've installed the python-firebase package, but when I import it into my program using 'import firebase', I get the following error:

    Traceback (most recent call last):
      File "C:\Users\hajel\AppData\Local\Programs\Python\Python37-32\Scripts\RFIDHandler.py", line 1, in <module>
        import firebase
      File "C:\Users\hajel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\firebase\__init__.py", line 3
        from .async import process_pool
                  ^
    SyntaxError: invalid syntax
    
  • Tushar
    Tushar almost 6 years
    It is generally not a good idea to edit a 3rd party library and to maintain your own version. Unless obviously, it's something just for practice. In production environments, it can be too much of a technical debt, if you need to update the library in future.
  • abnerh69
    abnerh69 about 4 years
    Downvoted cause it breaks the code for firebase.py and init.py on Python 3.8.2
  • Nam G VU
    Nam G VU over 2 years
    This must be the accepted answer in my view! Thank you @MZHm