HELPPP

0 Tobi Okubanjo · September 7, 2015
import random
import urllib.request

def download_web_image(url):
name = random.randrange(1, 1000)
full_name = str(name) + ".jpg"
urllib.request.urlretrieve(url, full_name)

download_web_image("https://www.thenewboston.com/images/homepage_images/main_homepage_01.png")




it gives this error

    import urllib.request
ImportError: No module named request

Process finished with exit code 1




i have no idea what to do please help

Post a Reply

Replies

Oldest  Newest  Rating
0 sfolje 0 · September 12, 2015
i am a bit late with my answer, u probably already solved it -.-

u r using wrong python interpreter - go in settings and change to 3.4

you r using : python 2.7.-
you should use : python 3.4.-

also not related problem : there 's a typo in
full_name = str(name) + ".jpg"
changk 'jpg' to 'png', since u r downloading a .png image.
worked fine for me.
0 sfolje 0 · September 12, 2015
im a bit answer, so u probablly already solvit -.-

U r using wrong interpreter - go to settings end change to version 3.4


  • language u r writting in : python 3.4

  • interpreter u r using : python 2.7

  • interpreter u should use : python 3.4



also unrelated problem in line:

full_name = str(name) + ".jpg"

change 'jpg' into 'png' since u r downloadin .png image
worked fine for me.
  • 1

Python

107,285 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator