##// END OF EJS Templates
proper python exception handling
stonebig <stonebig> -
Show More
@@ -19,7 +19,7 b' from __future__ import division'
19
19
20 try : #python2
20 try: #python2
21 from urllib import urlretrieve
21 from urllib import urlretrieve
22 except : #python3
22 except ImportError: #python3
23 from urllib.request import urlretrieve
23 from urllib.request import urlretrieve
24
24
25 davinci_url = "http://www.gutenberg.org/cache/epub/5000/pg5000.txt"
25 davinci_url = "http://www.gutenberg.org/cache/epub/5000/pg5000.txt"
@@ -78,7 +78,7 b" if __name__ == '__main__':"
78
78
79 try : #python2
79 try: #python2
80 cwd = os.path.abspath(os.getcwdu())
80 cwd = os.path.abspath(os.getcwdu())
81 except : #python3
81 except AttributeError: #python3
82 cwd = os.path.abspath(os.getcwd())
82 cwd = os.path.abspath(os.getcwd())
83 fnames = [ os.path.join(cwd, 'davinci%i.txt'%i) for i in range(n)]
83 fnames = [ os.path.join(cwd, 'davinci%i.txt'%i) for i in range(n)]
84 tic = time.time()
84 tic = time.time()
@@ -23,7 +23,7 b' from matplotlib import pyplot as plt'
23
23
24 try : #python2
24 try : #python2
25 from urllib import urlretrieve
25 from urllib import urlretrieve
26 except : #python3
26 except ImportError : #python3
27 from urllib.request import urlretrieve
27 from urllib.request import urlretrieve
28
28
29 # Top-level functions
29 # Top-level functions
General Comments 0
You need to be logged in to leave comments. Login now