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.
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.Code:from urllib import urlretrieve url=str(raw_input("URL: ")) name="img1.png" file = open(name, 'w') urlretrieve(url, name) file.close()
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?
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.
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.
![]()
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.
Posted via CodeCall Mobile
soz, im not following u? Can u explain?
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.
Posted via CodeCall Mobile
ok. But should that really stop some pics downloading and not others?
Posted via CodeCall Mobileok, well, i.ll have anotha look in the morning when im fresh eyed. Thx manux.![]()
The best that go together.
that is because this only works for .png images and not .jpg, jpeg, .gif, etc etc
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks