-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError in oauth2 #918
Comments
I'm not quite sure how you got this error, but the code seems to work without >>> import requests
>>> type(requests.Session)
<class 'type'> As you can see, it returns class This would also further break the code: >>> import spotipy
>>> import requests
>>> session = requests.Session()
>>> oauth = spotipy.oauth2.SpotifyAuthBase(requests_session=session)
>>> isinstance(type(oauth._session), type(requests.Session))
True # Yes, it returned True, but also this:
>>> oauth._session = 5 # or any other non session object
>>> isinstance(type(oauth._session), type(requests.Session))
True So just to make sure that you understand the purpose of the If the class gets destroyed (for example by stopping the python script), it will call this function so it can properly disconnect itself from the server. But before closing the connection, the function has to check if I hope you understand that this is not a bug, but an intended feature. (Python 3.10.5) |
Just to add that I am getting the same error in oauth2.py:156, but also in client.py line 214.
|
Can you give me a code snippet that would trigger the error? |
There is nothing strange in the code, but I can tell you it only happens when using flask, and the script is reloaded because of a change:
I used the app for a solid one minute (it has 3 flask routes only, heh, I just started it yesterday). Then had the euroka moment of forcing a reload. And immediatelly, the error appeared. Hope this helps a bit. I can email you the full script if you want, but I assure you, it's a skeleton app written off gpt. |
At the time of the reload, type(request.Session) is NoneType in /home/buanzo/.local/lib/python3.10/site-packages/spotipy/oauth2.py:156 |
That would be great, because I just created my own little flask app with spotipy and it works as expected. |
Mine is known. ***@***.***
you mail me, and i will not disclose it.
cheers
…On Sat, Apr 15, 2023, 10:31 Niko ***@***.***> wrote:
I can email you the full script if you want, but I assure you, it's a
skeleton app written off gpt.
That would be great, because I just created my own little flask app with
spotipy and it works as expected.
It would be nice if you could send it here, I don't really like having my
email address out in the open.
—
Reply to this email directly, view it on GitHub
<#918 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEHBTY6V34BXJUK4HIRMZTXBKPKJANCNFSM6AAAAAASZ6Z7GA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
It got censored. Try to add the address to your github profile and set it to public |
Google my alias, buanzo. find me anywhere. cheers.
…On Sat, Apr 15, 2023, 11:01 Niko ***@***.***> wrote:
It got censored. Try to add the address to your github profile and set it
to public
—
Reply to this email directly, view it on GitHub
<#918 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEHBTY6QIKAAWI6NGRCORLXBKS27ANCNFSM6AAAAAASZ6Z7GA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@buanzo why not paste a Minimal reproducible example here? It allows anyone with time to easily try it. |
On my Flask app I was starting the program with |
Can you provide an example code so that I can reproduce the issue |
@dieser-niko Yeah here's a really basic Flask and Spotipy app app.py
If you run this with
And if you run with Hope this helps |
Finally an example. Also I can't believe I'm saying this, but it works on my machine.. Also about that |
Sorry Niko, I totally changed my code in the meantime and the problem went
away, hence my lack of example -offering.
…On Fri, Jul 21, 2023, 06:10 Niko ***@***.***> wrote:
Finally an example. Also I can't believe I'm saying this, but it works on
my machine..
My guess is that it might be because of anaconda. Can you try running it
in native python instead?
Also about that python app.py, you need to put app.run() at the end of
the script to make it actually run.
—
Reply to this email directly, view it on GitHub
<#918 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEHBT6TF573QQBPQTM26NTXRJBPNANCNFSM6AAAAAASZ6Z7GA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
In file spotipy/oauth2.py in Class
SpotifyAuthBase
method__del__
. Both arguments were of different types.Before the code was:
After fixing:
Environment:
The text was updated successfully, but these errors were encountered: