strange problems with urllib2

Cousin Stanley cs at totallybogus.com.invalid
Thu Oct 27 10:37:02 EDT 2005



> When I run this code on windows it runs quickly 
> (about a second per image) but when I run it on linux 
> it runs very very slowly (10+ seconds per image).
> .... 

jdonnell ....

  I'm running a 1999 vintage 250 MHz Compaq
  with Debian Gnu/Linux & Python 2.3.5 ....

  The following version of your code
  worked very well here ....

# ---------------------------------------------------
#!/usr/bin/env python

'''
    NewsGroup .... comp.lang.python
    Date ......... 2005-10-26
    Posted_By .... jdonnell
    Edited_By .... Stanley C. Kitching
'''

import sys
import time
import urllib2

this_module = sys.argv[ 0 ]

beg = time.time()

f = urllib2.urlopen( 'http://site.heavenlytreasures.com/images/e6115.jpg' )

outfile = open( 'e6115.jpg' , 'wb' )

outfile.write( f.read() )

outfile.close()

f.close()

end = time.time()

dt  = end - beg

print 
print '    %s' % this_module
print
print '        Image saved .... %.4f Seconds ' % dt
print

# ---------------------------------------------------


sk at cpq1 :  ~/python  $ ./urllib2_image_get.py

    ./urllib2_image_get.py

        Image saved .... 0.3973 Seconds


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----



More information about the Python-list mailing list