[BangPypers] Problem with urlretrieve

Anirudh Asokan mails at anirudh.ind.in
Sun Aug 22 06:26:24 CEST 2010


Howdy mates,

             Im running Python 2.6.4 in Ubuntu 9.10 with mod_python. When I
run the following code in python IDLE -


urlretrieve('
http://www.pics4news.com/Eveant_Gallery/2008-09-06/Onam_Festival/Medium_Images/Onam_Festival_9834_medium.jpg
','/home/anirudh/onam.jpg')


its works and give me the following output -

('/home/anirudh/onam.jpg', <httplib.HTTPMessage instance at 0x9a681ec>)


Now when the same code is put in a file, say "leech.py" and is called from a
html page called html1.py, I get the following error report -


File "/home/anirudh/server/mod/tb/leech.py", line 51, in index
urlretrieve('
http://www.pics4news.com/Eveant_Gallery/2008-09-06/Onam_Festival/Medium_Images/Onam_Festival_9834_medium.jpg
','/home/anirudh/onam2.jpg')

File "/usr/lib/python2.6/urllib.py", line 94, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)

File "/usr/lib/python2.6/urllib.py", line 242, in retrieve
tfp = open(filename, 'wb')

IOError: [Errno 13] Permission denied: '/home/anirudh/onam2.jpg'



I tried with different name for the target file so that there will be no
problen of replaceing the file.

Got any idea whats going on guys?

-- 
Cheers,
Anirudh Asokan
www.anirudh.ind.in


More information about the BangPypers mailing list