Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

BUG: urllib.* modules are never imported #4700

Closed
yut23 opened this issue Oct 10, 2023 · 2 comments · Fixed by #4703
Closed

BUG: urllib.* modules are never imported #4700

yut23 opened this issue Oct 10, 2023 · 2 comments · Fixed by #4703
Labels
Milestone

Comments

@yut23
Copy link
Member

yut23 commented Oct 10, 2023

Bug report

Bug summary

The urllib submodules (request, parse, etc.) are used in a few code paths, most notably the command-line interface. Importing urllib on its own does nothing, as its __init__.py is empty (see https://github.com/python/cpython/tree/3.12/Lib/urllib/). This leads to a crash if the code tries to use the modules.

Code for reproduction

$ yt download --list

Actual outcome

Traceback (most recent call last):
  File "/home/eric/mambaforge/envs/yt-devel/bin/yt", line 8, in <module>
    sys.exit(run_main())
  File "/home/eric/build/yt/yt/utilities/command_line.py", line 1613, in run_main
    args.func(args)
  File "/home/eric/build/yt/yt/utilities/command_line.py", line 223, in run
    self(args)
  File "/home/eric/build/yt/yt/utilities/command_line.py", line 1555, in __call__
    self.get_list()
  File "/home/eric/build/yt/yt/utilities/command_line.py", line 1589, in get_list
    urllib.request.urlopen("http://yt-project.org/data/datafiles.json")
AttributeError: module 'urllib' has no attribute 'request'

Expected outcome

It should list all the data files available on https://yt-project.org/data.

Version Information

  • Operating System: Linux
  • Python Version: 3.10.12
  • yt version: git main (14c49c4)
@welcome
Copy link

welcome bot commented Oct 10, 2023

Hi, and welcome to yt! Thanks for opening your first issue. We have an issue template that helps us to gather relevant information to help diagnosing and fixing the issue.

@neutrinoceros
Copy link
Member

Thanks for spotting this ! I think this is probably a regression in 4.2.0, and my main suspect is #4265

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

Successfully merging a pull request may close this issue.

2 participants