OSError: ([Errno 98] Address already in use) in Streamlit while using spotipy

I use python 3.12
I am encountering an error when I try to use spotipy (A spotify API wrapper ) and deploy it here.

The link for the app is :
https://album-visualizer-laanith.streamlit.app

The screenshot is given below :

The logs are here.

Traceback (most recent call last):
File “/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 542, in _run_script
exec(code, module.dict)
File “/mount/src/album_visualizer/album_visualizer.py”, line 88, in
LogUserData()
File “/mount/src/album_visualizer/album_visualizer.py”, line 50, in LogUserData
my_details = sp.me()
^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/client.py”, line 1221, in me
return self._get(“me/”)
^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/client.py”, line 323, in _get
return self._internal_call(“GET”, url, payload, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/client.py”, line 247, in _internal_call
headers = self._auth_headers()
^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/client.py”, line 238, in _auth_headers
token = self.auth_manager.get_access_token(as_dict=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/oauth2.py”, line 535, in get_access_token
“code”: code or self.get_auth_response(),
^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/oauth2.py”, line 490, in get_auth_response
return self._get_auth_response_local_server(redirect_port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/oauth2.py”, line 457, in _get_auth_response_local_server
server = start_local_http_server(redirect_port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/oauth2.py”, line 1303, in start_local_http_server
server = HTTPServer((“127.0.0.1”, port), handler)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/socketserver.py”, line 457, in init
self.server_bind()
File “/usr/local/lib/python3.12/http/server.py”, line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File “/usr/local/lib/python3.12/socketserver.py”, line 473, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
2024-04-01 14:16:08.328 503 GET /script-health-check (10.12.89.173) 102.52ms
2024-04-01 14:16:13.149 Uncaught app exception
Traceback (most recent call last):
File “/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 542, in _run_script
exec(code, module.dict)
File “/mount/src/album_visualizer/album_visualizer.py”, line 88, in
LogUserData()
File “/mount/src/album_visualizer/album_visualizer.py”, line 50, in LogUserData
my_details = sp.me()
^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/client.py”, line 1221, in me
return self._get(“me/”)
^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/client.py”, line 323, in _get
return self._internal_call(“GET”, url, payload, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/client.py”, line 247, in _internal_call
headers = self._auth_headers()
^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/client.py”, line 238, in _auth_headers
token = self.auth_manager.get_access_token(as_dict=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/oauth2.py”, line 535, in get_access_token
“code”: code or self.get_auth_response(),
^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/oauth2.py”, line 490, in get_auth_response
return self._get_auth_response_local_server(redirect_port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/oauth2.py”, line 457, in _get_auth_response_local_server
server = start_local_http_server(redirect_port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.12/site-packages/spotipy/oauth2.py”, line 1303, in start_local_http_server
server = HTTPServer((“127.0.0.1”, port), handler)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/socketserver.py”, line 457, in init
self.server_bind()
File “/usr/local/lib/python3.12/http/server.py”, line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File “/usr/local/lib/python3.12/socketserver.py”, line 473, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
2024-04-01 14:16:13.251 503 GET /script-health-check (10.12.89.173) 102.54ms

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.