Skip to content
Snippets Groups Projects
Commit 6873cd6b authored by Manuel Günther's avatar Manuel Günther
Browse files

Fixed urllib for python 3.

parent fbdf09fd
No related branches found
No related tags found
No related merge requests found
*.swp
*~
*.swp
*.pyc
*.png
*.pdf
*.so
*.dylib
CMakeLists.txt
bin
eggs
parts
.installed.cfg
.mr.developer.cfg
eggs/
develop-eggs/
bob.example.faceverify.egg-info/
*.egg-info
develop-eggs
sphinx
dist
.nfs*
.gdb_history
build
*.egg
src/
bin/
dist/
sphinx/
Database/
*.png
*.pdf
......@@ -41,14 +41,19 @@ def atnt_database_directory(atnt_user_directory = None):
os.mkdir(atnt_default_directory)
# setup
import urllib2, tempfile
import sys, tempfile
if sys.version_info[0] <= 2:
import urllib2 as urllib
else:
import urllib.request as urllib
db_url = 'http://www.cl.cam.ac.uk/Research/DTG/attarchive/pub/data/att_faces.zip'
import logging
logger = logging.getLogger('bob')
logger.warn("Downloading the AT&T database from '%s' to '%s' ..." % (db_url, atnt_default_directory))
# download
url = urllib2.urlopen(db_url)
url = urllib.urlopen(db_url)
local_zip_file = tempfile.mkstemp(prefix='atnt_db_', suffix='.zip')[1]
dfile = open(local_zip_file, 'w')
dfile.write(url.read())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment