Skip to content

Commit 0f12c5c

Browse files
committed
Work around shoddy typing in urllib library
Issue #151
1 parent 99cda08 commit 0f12c5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tern.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def f(port, doc):
264264
req = opener.open("http://" + localhost + ":" + str(port) + "/", json.dumps(doc).encode("utf-8"), 1)
265265
return json.loads(req.read().decode("utf-8"))
266266
except urllib.error.URLError as error:
267-
raise Req_Error(error.read().decode("utf-8"))
267+
raise Req_Error((hasattr(error, "read") and error.read().decode("utf-8")) or error.reason)
268268
return f
269269

270270
if python3:

0 commit comments

Comments
 (0)