[GH-ISSUE #838] I try example app.py but still got error AttributeError: module 'spotipy.cache_handler' has no attribute 'FlaskSessionCachceHandler' #519

Closed
opened 2026-02-27 23:23:05 +03:00 by kerem · 2 comments
Owner

Originally created by @febridev on GitHub (Jul 10, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/838

I try using example code from this repo filename is app.py but I still got error

AttributeError: module 'spotipy.cache_handler' has no attribute 'FlaskSessionCachceHandler'

I copy and paste and follow the instruction but still got error on above

when I change the attribute to MemoryCacheHandler I can't login

Originally created by @febridev on GitHub (Jul 10, 2022). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/838 <!--- Please make sure you've: - read the FAQ https://github.com/plamere/spotipy/blob/master/FAQ.md - read the documentation https://spotipy.readthedocs.io/en/latest/ - searched older issues If your question is about code, please share the code you are using ---> I try using example code from this repo filename is app.py but I still got error `AttributeError: module 'spotipy.cache_handler' has no attribute 'FlaskSessionCachceHandler'` I copy and paste and follow the instruction but still got error on above when I change the attribute to MemoryCacheHandler I can't login
kerem 2026-02-27 23:23:05 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@Aspecky commented on GitHub (Jul 11, 2022):

That's because for some reason the spotipy that comes by using pip install spotipy isn't up to date with the github, so what I did to fix the issue is:

  1. Setup a python venv in your project directory
    cd your_project_dir
    python3 -m venv venv > On linux you need to install python3-pip and python3-venv packages first.
  2. Install spotipy and your other packages if you need.
  3. In your newly created venv folder, navigate to venv/lib64/python3.10/site-packages/spotipy
  4. In that directory you will find a file called cache_handler.py, go here and copy that and paste it in that file.
  5. Save and reload your project and that should work.
<!-- gh-comment-id:1180726732 --> @Aspecky commented on GitHub (Jul 11, 2022): That's because for some reason the spotipy that comes by using `pip install spotipy` isn't up to date with the github, so what I did to fix the issue is: 1. Setup a python venv in your project directory `cd your_project_dir` `python3 -m venv venv` > On linux you need to install `python3-pip` and `python3-venv` packages first. 2. Install `spotipy` and your other packages if you need. 3. In your newly created `venv` folder, navigate to `venv/lib64/python3.10/site-packages/spotipy` 4. In that directory you will find a file called `cache_handler.py`, go [here](https://raw.githubusercontent.com/plamere/spotipy/master/spotipy/cache_handler.py) and copy that and paste it in that file. 5. Save and reload your project and that should work.
Author
Owner

@stephanebruckert commented on GitHub (Aug 22, 2022):

Duplicate of https://github.com/plamere/spotipy/issues/838

<!-- gh-comment-id:1222681959 --> @stephanebruckert commented on GitHub (Aug 22, 2022): Duplicate of https://github.com/plamere/spotipy/issues/838
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#519
No description provided.