Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ImportError: cannot import name 'create_urllib3_context' from 'urllib3.util' #237

Closed
ghost opened this issue Sep 11, 2024 · 5 comments
Closed
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Sep 11, 2024

Bug Description
First moment i was trying to download, bandcamp-dl is returned with "AttributeError" errors...
Reintalled and updated python, now it fails to download with ImportError;
The program worked before.

To Reproduce
Command to reproduce the behavior:
bandcamp-dl --base-dir=Music/Myfolder -e -f -k -u -o -r [any link]

Expected behavior
Attempting to run the command will return the following error:

Logs

Traceback (most recent call last):
  File "/usr/bin/bandcamp-dl", line 5, in <module>
    from bandcamp_dl.__main__ import main
  File "/usr/lib/python3.12/site-packages/bandcamp_dl/__main__.py", line 27, in <module>
    from bandcamp_dl.bandcamp import Bandcamp
  File "/usr/lib/python3.12/site-packages/bandcamp_dl/bandcamp.py", line 9, in <module>
    from urllib3.util import create_urllib3_context
ImportError: cannot import name 'create_urllib3_context' from 'urllib3.util' (/usr/lib/python3.12/site-packages/urllib3/util/__init__.py)

Desktop:
OS: Arch Linux
Version: 6.6.49-l-lts
Python Version: 3.12.5-1

@ghost ghost added the bug label Sep 11, 2024
@ghost ghost assigned Evolution0 Sep 11, 2024
@Evolution0
Copy link
Collaborator

Which version of urllib is installed? pip freeze | grep urllib

@Evolution0
Copy link
Collaborator

urllib3 = 1.26.20

Upgrade to 2.x.x if possible.

@jneidel
Copy link
Contributor

jneidel commented Sep 12, 2024

I have the same problem.

Not a python dev, but shouldn't urllib3 be declared as a dependency in pyproject.toml? Then you can declare a v2 requirement and have the app fail gracefully.

@jneidel
Copy link
Contributor

jneidel commented Sep 12, 2024

@SinfulChaser I addressed the issue in the arch pkg:
yay -S bandcamp-dl-git

@Evolution0
Copy link
Collaborator

I have the same problem.

Not a python dev, but shouldn't urllib3 be declared as a dependency in pyproject.toml? Then you can declare a v2 requirement and have the app fail gracefully.

Yes, some quirks slipped through between PRs, I blame the lack of automated testing.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants