summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fetch.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/fetch.py b/fetch.py
index d79f9479..c954a9c2 100644
--- a/fetch.py
+++ b/fetch.py
@@ -17,6 +17,8 @@
17import subprocess 17import subprocess
18import sys 18import sys
19from urllib.parse import urlparse 19from urllib.parse import urlparse
20from urllib.request import urlopen
21
20 22
21def fetch_file(url, verbose=False): 23def fetch_file(url, verbose=False):
22 """Fetch a file from the specified source using the appropriate protocol. 24 """Fetch a file from the specified source using the appropriate protocol.
@@ -39,7 +41,5 @@ def fetch_file(url, verbose=False):
39 print('fatal: error running "gsutil": %s' % e.stderr, 41 print('fatal: error running "gsutil": %s' % e.stderr,
40 file=sys.stderr) 42 file=sys.stderr)
41 sys.exit(1) 43 sys.exit(1)
42 if scheme == 'file': 44 with urlopen(url) as f:
43 with open(url[len('file://'):], 'rb') as f: 45 return f.read()
44 return f.read()
45 raise ValueError('unsupported url %s' % url)