AttributeError: 'NoneType' object has no attribute 'replace' during authentication
I am encountering an issue with gcalcli when trying to authenticate. Below is the traceback of the error:
Traceback (most recent call last): File "/home/m/.local/bin/gcalcli", line 7, in <module> sys.exit(main()) ~~~~^^ File "/home/m/.local/lib/python3.13/site-packages/gcalcli/cli.py", line 235, in main gcal = GoogleCalendarInterface( cal_names=cal_names, ...<4 lines>... **vars(parsed_args), ) File "/home/m/.local/lib/python3.13/site-packages/gcalcli/gcal.py", line 92, in __init__ self._get_cached() ~~~~~~~~~~~~~~~~^^ File "/home/m/.local/lib/python3.13/site-packages/gcalcli/gcal.py", line 330, in _get_cached self.get_cal_service().calendarList().list( ~~~~~~~~~~~~~~~~~~~~^^ File "/home/m/.local/lib/python3.13/site-packages/gcalcli/gcal.py", line 297, in get_cal_service credentials=self._google_auth(), ~~~~~~~~~~~~~~~~~^^ File "/home/m/.local/lib/python3.13/site-packages/gcalcli/gcal.py", line 170, in _google_auth self.SetupAuth() ~~~~~~~~~~~~~~^^ File "/home/m/.local/lib/python3.13/site-packages/gcalcli/gcal.py", line 279, in SetupAuth self.credentials = auth.authenticate( ~~~~~~~~~~~~~~~~~^ client_id, ^^^^^^^^^^ ...<2 lines>... local=self.options['auth_local_server'], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/home/m/.local/lib/python3.13/site-packages/gcalcli/auth.py", line 52, in authenticate credentials = flow.run_local_server(open_browser=False, port=port) File "/home/m/.local/lib/python3.13/site-packages/google_auth_oauthlib/flow.py", line 457, in run_local_server authorization_response = wsgi_app.last_request_uri.replace("http", "https") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'replace'
Python Versions Used
Python 3.11
Python 3.13
Steps Taken
Updated to the latest version of gcalcli and related dependencies.
Verified OAuth 2.0 Client ID and Secret from Google Cloud Console.
Tried running the command with --auth_local_server and without it.
Cleared the gcalcli cache and reinitialized.
Despite these efforts, the error persists. Has anyone else experienced this issue? Any guidance on how to resolve it would be greatly appreciated!
Thank you!
What version of google_auth_oauthlib do you have installed? If you look at the stack trace, it's clearly the library code that's messed up, accessing its wsgi_app.last_request_uri thing without handling None. I'd try to repro either with newer google_auth_oauthlib (if Google still maintains it) or older Python.