Python Forum
Whats my python program's problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Whats my python program's problem
#13
I got it.I just searched throgh the external libray and saw the module name is changed to urllib and its not urllib.request.

(Mar-13-2017, 01:55 PM)zivoni Wrote: As I wrote earlier, python2.7 does not have urllib.request library. You can either use python3 with your original code, or change your code to either use requests or urllib. This code should work with python 2.7 - uses just urllib
 import random import urllib def download_web_image(url):     name=random.randrange(1,1000)     fullname=str(name)+".jpg"     urllib.urlretrieve(url,fullname)   download_web_image("http://www.reef2reef.com/data/ams/431/431079-8956905e1ef117b2e057a39686ede6a4.jpg") 
EDIT: If you are just starting with python and following tutorial with python3 examples, you should install and use python 3.x instead of python 2.7
yes that was my problem.

(Mar-13-2017, 01:48 PM)wavic Wrote: The module is requests with 's'. My bad. Which Python version do you use?
I use pycharm2016.3.2

One more thing,i love programming and i just programmed c++ about two years ago and im interested in micro controllers such as ARM,AVR,...
I get started with python when i wanted to get familiar to raspberry boards.
Is there any books or videos that can help me learning about python more and more?
Reply


Messages In This Thread
Whats my python program's problem - by arman - Mar-12-2017, 09:13 PM
RE: Whats my python program's problem - by arman - Mar-12-2017, 09:27 PM
RE: Whats my python program's problem - by wavic - Mar-12-2017, 09:29 PM
RE: Whats my python program's problem - by arman - Mar-12-2017, 09:31 PM
RE: Whats my python program's problem - by zivoni - Mar-12-2017, 09:44 PM
RE: Whats my python program's problem - by arman - Mar-13-2017, 01:43 PM
RE: Whats my python program's problem - by wavic - Mar-12-2017, 09:48 PM
RE: Whats my python program's problem - by zivoni - Mar-12-2017, 09:58 PM
RE: Whats my python program's problem - by wavic - Mar-12-2017, 10:42 PM
RE: Whats my python program's problem - by wavic - Mar-13-2017, 01:48 PM
RE: Whats my python program's problem - by zivoni - Mar-13-2017, 01:55 PM
RE: Whats my python program's problem - by arman - Mar-13-2017, 02:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Whats wrong with the elif? inunanimous93 3 2,536 Nov-30-2020, 03:58 AM
Last Post: deanhystad
  Whats Wrong!? rjay81 3 2,293 May-13-2020, 08:02 PM
Last Post: rjay81
  Can u see this code and tell whats wrong with it? AhmadKamal 14 5,478 Apr-29-2020, 11:09 AM
Last Post: jefsummers
  Whats a good design/approach? hshivaraj 1 1,814 Sep-16-2019, 01:44 AM
Last Post: snippsat
  Problem: Once I cancel the process my program will start working! Hadad 0 1,676 Jul-24-2019, 04:09 PM
Last Post: Hadad
  elevator simulator...whats the wrong at this code? tasos710 5 5,971 Jun-11-2019, 01:38 AM
Last Post: micseydel
  Program Problem (2) ChrisG 2 2,423 May-25-2019, 05:11 PM
Last Post: ChrisG
  Program Problem ChrisG 2 2,006 May-25-2019, 11:41 AM
Last Post: ChrisG
  whats the difference between sys.exit() and break? mitmit293 1 4,148 Jan-27-2019, 09:46 PM
Last Post: ichabod801
  Whats wrong with this code? student1 1 2,459 May-18-2018, 04:19 PM
Last Post: skorpius_

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020