cn-deep-learning icon indicating copy to clipboard operation
cn-deep-learning copied to clipboard

"ImportError: No module named request" error

Open caofangkun opened this issue 7 years ago • 2 comments

urllib.request modules have been deprecated, urllib.request.urlretrieve should be urllib.urlretrieve

➜  face-generation git:(master) python --version 
Python 2.7.14 :: Anaconda custom (64-bit)

➜  face-generation git:(master) jupyter notebook dlnd_face_generation.ipynb

image

  File "helper.py", line 215
    self.image_mode)
SyntaxError: only named arguments may follow *expression

caofangkun avatar Jan 19 '18 03:01 caofangkun

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-2fe1a6e71a9d> in <module>()
      8 DON'T MODIFY ANYTHING IN THIS CELL
      9 """
---> 10 import helper
     11 
     12 helper.download_extract('mnist', data_dir)

/home/ablecao/workspace/cn-deep-learning/face-generation/helper.py in <module>()
      2 import os
      3 import hashlib
----> 4 from urllib.request import urlretrieve
      5 import zipfile
      6 import gzip

ImportError: No module named request

image

caofangkun avatar Jan 19 '18 03:01 caofangkun

Python 3.* should use: from unittest import mock

Python 2.* use: from mock import mock

caofangkun avatar Jan 19 '18 07:01 caofangkun