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

scripts/bench/run_all.py : module 'urllib' has no attribute 'urlretrieve' #230

Closed
jamespharvey20 opened this issue Apr 28, 2019 · 1 comment

Comments

@jamespharvey20
Copy link

Description

run_all.py gives me the following error:


************** header

== doctest

python ./bench.py compile gcc   --debug --files 200 --tests 0
Traceback (most recent call last):
  File "./bench.py", line 60, in <module>
    urllib.urlretrieve("https://github.com/catchorg/Catch2/releases/download/v" + catch_ver + "/catch.hpp", catch_header)
AttributeError: module 'urllib' has no attribute 'urlretrieve'
Traceback (most recent call last):
  File "./run_all.py", line 48, in <module>
    res = float(runBench(command))
ValueError: could not convert string to float:

Fix

These changes make it run properly:

@ line 8
-import urllib
+import urllib.request
@ line 60
-    urllib.urlretrieve("https://github.com/catchorg/Catch2/releases/download/v" + catch_ver + "/catch.hpp", catch_header)
+    urllib.request.urlretrieve("https://github.com/catchorg/Catch2/releases/download/v" + catch_ver + "/catch.hpp", catch_header)

I don't know what the proper fix would be to not break it on systems using urllib before urlretrieve was moved into request.

Steps to reproduce

cd scripts/bench && ./run_all.py

Extra information

  • doctest version: v2.3.1
  • Operating System: Arch Linux
  • Compiler+version: python 3.7.3, and python-urllib3 1.24.2
@onqtam
Copy link
Member

onqtam commented Apr 29, 2019

I should probably move to python 3.x :)
Thanks for the fix! I'll incorporate it... when I can.

@onqtam onqtam closed this as completed in 7435f4a May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants