pe-st / garmin-connect-export

Download a copy of your Garmin Connect data, including stats and GPX tracks.
MIT License
364 stars 75 forks source link

AttributeError: module 'urllib.request' has no attribute 'HTTPSHandler' #88

Open magalive1991 opened 1 year ago

magalive1991 commented 1 year ago

Hello here, for a couple of months now I'm getting the error in the title when running gcexport.py, I just downloaded the most recent version of the package and still have the same error. The problem is this line of code:

OPENER = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(COOKIE_JAR), urllib.request.HTTPSHandler(debuglevel=0))

I investigated and it can seem like a python 2 vs python 3 error but I checked and I use python 3.9 so it should work. Can anyone help ? Thanks a lot

centic9 commented 1 year ago

Maybe your version of module urllib.request is outdated?

Which version do you have installed? On Debian/Ubuntu it is provided by package python3-urllib3

The README does currently not state any minimum required version, would be good to list it as part of the installation steps.

magalive1991 commented 1 year ago

thanks for your answer, I am on windows and do have urllib3 installed

pip install urllib3 Requirement already satisfied: urllib3

pip show urllib3 Name: urllib3 Version: 1.26.14 (last version)

magalive1991 commented 1 year ago

edit. it's working in anaconda prompt but not in command prompt

bxsx commented 1 year ago

You don't need urllib3, this project uses the urllib from the standard library.

I would start the investigation from here: https://docs.python.org/3/library/urllib.request.html#urllib.request.build_opener

If the Python installation has SSL support (i.e., if the ssl module can be imported), HTTPSHandler will also be added.

pe-st commented 1 year ago

bxsx is right, the project doesn't use urllib3 (there is no import urllib3...)

When you add a line (at around line 30 of gcexport.py)

import ssl

do you still get the same error? Or something like ModuleNotFoundError: No module named 'ssl' ?