2

I need some help. I'm new to Heroku and I'm getting log errors telling me...

"ModuleNotFoundError: No module named 'urllib2' 

I thought urllib2 package was part of Python?

Any ideas on how to fix this? My app uses urllib2 extensively.

Caleb Hearth
  • 3,315
  • 5
  • 30
  • 44
Tim Hiatt
  • 103
  • 2
  • 14
  • 2
    Possible duplicate: https://stackoverflow.com/questions/34740288/importerror-no-module-named-urllib2-python-3 and https://stackoverflow.com/questions/2792650/python3-error-import-error-no-module-name-urllib2 – Mr. T Dec 08 '17 at 15:49
  • always put full error message (Traceback) in question (as text, not screenshot). There are other useful informations. – furas Dec 10 '17 at 22:53

1 Answers1

0

Ok. So the answer was Quite simple. urllib2 is not part of Python 2. I am using Python 2. Python 3 has urllib2.

If fixed my issue of using urllib2 by getting heroku to build the application against python 2 not 3 like it defaults to. The documentation on the Heroku website shows me how to make a "runtime.txt" file to specify the version of Python I would like the app built against.

Tim Hiatt
  • 103
  • 2
  • 14