PY3: Use io.open to write bytes in python 2/3

This commit is contained in:
Kelsey Jordahl
2014-04-16 12:54:49 -04:00
parent b7041ee748
commit 0c80da73d5
+2 -1
View File
@@ -1,3 +1,4 @@
import io
import os.path
from six.moves.urllib.request import urlopen
@@ -28,7 +29,7 @@ def download_nybb():
# saved as geopandas/examples/nybb_13a.zip.
filename = os.path.join('examples', 'nybb_13a.zip')
if not os.path.exists(filename):
with open(filename, 'w') as f:
with io.open(filename, 'wb') as f:
response = urlopen('http://www.nyc.gov/html/dcp/download/bytes/nybb_13a.zip')
f.write(response.read())
return filename