Skip to content

Commit 09535e0

Browse files
committed
fix syntax error in catching HTTPError exception
1 parent 010950c commit 09535e0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

wfdb/_rdsamp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import requests
66
from configparser import ConfigParser
7+
import urllib2
78
# from distutils.sysconfig import get_python_lib
89

910
def checkrecordfiles(recordname, filedirectory):
@@ -202,7 +203,7 @@ def dlrecordfiles(pbrecname, targetdir):
202203
with open(targetfile, "w") as text_file:
203204
text_file.write(r.text)
204205
dledfiles.append(targetfile)
205-
except HTTPError:
206+
except requests.HTTPError:
206207
if madetargetdir:
207208
# Remove the recently created faulty directory.
208209
os.rmdir(targetdir)
@@ -275,7 +276,7 @@ def dlorexit(url, filename, dledfiles, displaydlmsg=0, targetdir=[]):
275276
text_file.write(r.text)
276277
dledfiles.append(filename)
277278
return dledfiles
278-
except HTTPError:
279+
except requests.HTTPError:
279280
sys.exit("Attempted to download invalid target file: " + url)
280281

281282

0 commit comments

Comments
 (0)