Receiving .async error when trying to import the firebase package - python

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

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

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

ya because your action is wrong its a system-generated file
don't comment it just follows steps
1)rename .async into .async_
2)open__init__ file and change .async into .async_
3)open firebase.py and change .async into .async_
because of .async is the keyword now is current version in python
Done>>>>>>>>>>

I commented "#from .async import process_pool" in firebase.py and started working, it was incompatible with python 3.7

Related

Import discord.py returns the error " ModuleNotFoundError: aiohttp”

I am working on a project in which you will need to unpack the archive with all the data and everything will work, without installing packages by the user. I came to the creation of a discord bot, but it gives an error, I do not understand what is associated with it.
Traceback (most recent call last):
File "path\Project Folder\bot.py", line 2, in <module>
import modules.discord
File "path\Project Folder\modules\discord\__init__.py", line 25, in <module>
from .client import Client
File "path\Project Folder\modules\discord\client.py", line 33, in <module>
import aiohttp
ModuleNotFoundError: No module named 'aiohttp'
Before that, I downloaded pythonping absolutely as well and there were no errors when importing it.
Downloaded it like this:
pip install --target="path\Project Folder\modules" pythonping
pip install --target="path\Project Folder\modules" discord.py
The folder where it was downloaded looks like this (initially it was empty):
If I change the import of the discord in the same file, and add pythonping, then everything will work without errors.
from modules.pythonping import ping
#import modules.discord
import botinfo
print(botinfo.BotTag)
At the very end, I manually downloaded the discord archive from github and put it in the modules directory, but since there is no aiohttp, ctrl+click did not redirect to it, after which I already downloaded aiohttp pip install --target="path\project folder\modules" aiohttp and ctrl+click began to go to aiohttp, but the error remained (absolutely the same).
Additional information:
python --version Python 3.8.2
pip --version pip 21.0.1
For some reason, the python version decided to change from the last to the previous one, which is why discord did not run on the NEW version, because it still took packages not from the project directory, but from the interpreter directory. I switched to an earlier version of python and it worked, then I forcibly downloaded it to the new version and it also worked.
I think running the following command might be a good idea :
pip install aiohttp

"ModuleNotFoundError : No module named 'apiclient ' "

I recently tried to view Google Calendar using python . To do that I referred Python Quickstart. I did the steps that were mentioned in the website.
I completed the second step and downloaded the secretclient.json file.
In the terminal I typed in :
pip install --upgrade google-api-python-client
as I was instructed in the website.
I ran the python that was on the website and when I compiled I got the error:
Blockquote
Traceback (most recent call last):
File "quickstart.py", line 2, in
from apiclient import discovery
ModuleNotFoundError: No module named 'apiclient'
The Lines which correspond to the error are :
from apiclient import discovery
Why is the apiclient module unavailable ?
Could it be that you're using a different python version than what the pip installed? For example, if you use python3 to execute the problematic import line, but pip is for python2. Or if you use conda or another python distribution that uses a different path to import the packages from.
You can verify it if you just open from the command line:
python
then
from apiclient import discovery
and check if you still get the error.
you can resolve this by going to Script folder of your Python installation directory and running from there
e.g.
cd D:\Python27\Scripts\
python
from apiclient import discovery
Mainly this issue arises when u have more than one python installation , as noob have suggested

python help('modules') returns ImportError

Recently, (I have no idea when), I installed this package called pymol. Today when I was trying to copy a list of all my install modules, I encountered this error.
~/Projects$ python -c "help('modules')"
Please wait a moment while I gather a list of all available modules...
Error: unable to initalize the pymol.cmd module
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pymol/cmd.py", line 117, in <module>
from chempy import io
ImportError: cannot import name io
I've tried
sudo pip uninstall pymol
This definitely worked... but it also definitely did not work. It removed the .egg, and pip list tells me it's not installed, but the tool is still there. I open a python prompt and import it with no problem. Now my question is, if I just delete the package, is there anything that could go wrong, (WCS I'm thinking kafkaesque broken dependency fixing for the rest of my natural life.) and is there a standardized, best practice to remove this, or any other package manually.

cannot import Python-Twitter

I recently started out with python and i'm right now looking to do an app that shows my Twitter feed. So I downloaded a module(not sure if its called that) called Python-Twitter and installed it. But now everytime I try to import it I just get this error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import twitter
File "build\bdist.win32\egg\twitter.py", line 38, in <module>
File "C:\Python27\lib\site-packages\requests_oauthlib-0.4.0-py2.7.egg\requests_oauthlib\__init__.py", line 1, in <module>
from .oauth1_auth import OAuth1
File "C:\Python27\lib\site-packages\requests_oauthlib-0.4.0-py2.7.egg\requests_oauthlib\oauth1_auth.py", line 4, in <module>
from requests.utils import to_native_string
ImportError: cannot import name to_native_string
Does anyone know what I might have done wrong with the install or something? Thx
In my case installing requests-oauthlib fixed it
sudo pip install requests-oauthlib
This is because of requests version.
requests.utils.to_native_string is available since requests 2.0.0
So just update requests:
pip install -U requests
See more details here on another thread
This sounds like an issue with your install. The method to_native_string should be defined in the requests\utils.py in your Python install.
I'm on Ubuntu, and installed the Twitter module, and can import it without any errors. When I look in my install, in /usr/lib/python2.7/dist-packages/requests/utils.py, there is a to_native_string method defined there.
The implication from the error you're getting is that in your installation, there is either no utils.py, or, if there is, it does not contain that method.
I would recommend checking your install to see if that is the case. If it is indeed missing, I would recommend axing your install and reinstalling. You might want to try a virtualenv environment instead, so it can act as a sandbox (in that case you can leave your current install as is, as long as it is intact enough to run virtualenv and pip).
If utils.py is actually there and does contain a method with that name, I would recommend running a debugger such as pudb or pdb (pudb isn't built in, but it's more full featured), and step through the import to see if that sheds any additional light.

Error during library import in Python (Windows)

I am trying to configure svn hook for email notification using mailer.py script from apache, but it always crash on import of svn libs. I try two ways of installing svn and python. I try to install everything manually using command line and use CollableNet installer that have preinstalled Python and all libs I need but result is the same.
Now I try to import one library from hole package that I need using python in command line and I have such response:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svn.core
I try to fix it using:
1) import sys; sys.path.append("C:\csvn\lib\svn-python\svn")
and
2) C:\csvn\lib\svn-python\svn>python "\__init__.py" install
But it didn't help.
For now I have no package with setup.py to install it.
I spend a lot of time on this task, and going crazy a little). Please give me any suggestion how to fix it.

Categories

Resources