Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: i dont understand?!?!?!

  1. #1
    Hot_Milo23's Avatar
    Hot_Milo23 is offline Programmer
    Join Date
    Jun 2009
    Location
    Western Australia
    Posts
    120
    Rep Power
    11

    i dont understand?!?!?!

    ive sort of brought this issue up on another thread, but i thought i might open it up here too.
    i can find absolutely no explanation why this code works for some images and not others. if anyone could help it would be much appreciated.
    Code:
    from urllib import urlretrieve
    url=str(raw_input("URL: "))
    name="img1.png"
    file = open(name, 'w')
    urlretrieve(url, name)
    file.close()
    so the code asks for the url of a picture off the net, converts it to png, and saves it as img1.png. i went to google and saved the logo ->worked fine.
    tried saving other images from around the web ->no problems.
    but when i try to save ANY images from this site:
    Pokmon-X
    I dont understand why!!!
    so, any ideas?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    manux's Avatar
    manux is offline Programming Professional
    Join Date
    Oct 2008
    Posts
    234
    Blog Entries
    1
    Rep Power
    14

    Re: i dont understand?!?!?!

    First image I see
    http://pokemonx.comicgenesis.com/comics/20090429.png
    No problem poking it with python,
    perhaps you're not entering the right url, or the right image name...
    If I were you, I'd write a html parser that scans for the right images using regex, but I guess I like to complicate things uselessly .

  4. #3
    Hot_Milo23's Avatar
    Hot_Milo23 is offline Programmer
    Join Date
    Jun 2009
    Location
    Western Australia
    Posts
    120
    Rep Power
    11

    Re: i dont understand?!?!?!

    when i use that url i get a 1x1 pixel??
    same as all the other ones i try.
    and im copying and pasting the urls into the program.

  5. #4
    manux's Avatar
    manux is offline Programming Professional
    Join Date
    Oct 2008
    Posts
    234
    Blog Entries
    1
    Rep Power
    14

    Re: i dont understand?!?!?!

    Hum, actually, why do you open a file???
    I just checked the man, you dont even need to pass a file object, just the local filename is enough for the second argument.

  6. #5
    Hot_Milo23's Avatar
    Hot_Milo23 is offline Programmer
    Join Date
    Jun 2009
    Location
    Western Australia
    Posts
    120
    Rep Power
    11

    Re: i dont understand?!?!?!

    Posted via CodeCall Mobile
    soz, im not following u? Can u explain?

  7. #6
    manux's Avatar
    manux is offline Programming Professional
    Join Date
    Oct 2008
    Posts
    234
    Blog Entries
    1
    Rep Power
    14

    Re: i dont understand?!?!?!

    you do not need to do:
    f=file(name,"w")
    urlretr(...) #your not even passing f as an arg here
    f.close()

    just do urlretreive.

  8. #7
    Hot_Milo23's Avatar
    Hot_Milo23 is offline Programmer
    Join Date
    Jun 2009
    Location
    Western Australia
    Posts
    120
    Rep Power
    11

    Re: i dont understand?!?!?!

    Posted via CodeCall Mobile
    ok. But should that really stop some pics downloading and not others?

  9. #8
    Hot_Milo23's Avatar
    Hot_Milo23 is offline Programmer
    Join Date
    Jun 2009
    Location
    Western Australia
    Posts
    120
    Rep Power
    11

    Re: i dont understand?!?!?!

    Posted via CodeCall Mobileok, well, i.ll have anotha look in the morning when im fresh eyed. Thx manux.

  10. #9
    givislo is offline Newbie
    Join Date
    Oct 2009
    Posts
    1
    Rep Power
    0

    Re: i dont understand?!?!?!

    The best that go together.

  11. #10
    Excited is offline Newbie
    Join Date
    Oct 2009
    Posts
    27
    Rep Power
    0

    Re: i dont understand?!?!?!

    that is because this only works for .png images and not .jpg, jpeg, .gif, etc etc

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. cookies i dont understand 100%
    By alrazy1 in forum PHP Development
    Replies: 5
    Last Post: 01-10-2011, 12:24 AM
  2. I dont get it :S >:(
    By giv3mesmile in forum Visual Basic Programming
    Replies: 4
    Last Post: 01-23-2010, 02:49 AM
  3. Replies: 9
    Last Post: 11-04-2008, 10:44 PM
  4. I dont understand this parser code
    By Salrandin in forum C and C++
    Replies: 3
    Last Post: 10-23-2007, 09:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts