Skip to content

Commit

Permalink
Update data_geo_streets.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Jan 9, 2019
1 parent 8569f7e commit 99a75bb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ensae_projects/datainc/data_geo_streets.py
Expand Up @@ -33,16 +33,17 @@ def get_seattle_streets(filename=None, folder="."):
The function returns a filename.
"""
if filename is None:
download_data("WGS84_seattle_street.zip", whereTo=folder)
filename = os.path.join(folder, "Street_Network_Database.shp")
if not os.path.exists(filename):
names = download_data("WGS84_seattle_street.zip", whereTo=folder)
shp = [n for n in names if n.endswith('.shp')]
if len(shp) != 1:
from pyquickhelper.loghelper import BufferedPrint
buf = BufferedPrint()
names = download_data("WGS84_seattle_street.zip",
whereTo=folder, fLOG=buf.fprint)
raise FileNotFoundError(
"Unable to download data 'WGS84_seattle_street.zip' to '{0}', log={1}\nnames={2}.".format(
filename, str(buf), "\n".join(names)))
filename = shp[0]
elif not os.path.exists(filename):
raise FileNotFoundError(filename)
return filename
Expand Down

0 comments on commit 99a75bb

Please sign in to comment.