Size of a remote URL
Justin
justin__devine at hotmail.com
Mon Aug 30 16:48:33 EDT 2004
Ok now I have what I consider to be a very odd problem. It appears my
code will not work inside a for loop but will work outside of one.
Check it out
temp =
urlopen("http://www.ecs.soton.ac.uk/~harnad/Temp/Ariadne-RAE.doc")
print temp
temp2 = temp.info()
print temp2
temp3 = temp2.getheader("Content-Length")
print temp3
for y in linklisttype:
temp = urlopen(y)
print temp
temp2 = temp.info()
print temp2
temp3 = temp2.getheader("Content-Length")
print temp3
file_sizes.append(temp3)
THIS IS THE CODE RETURNED IN THE CONSOLE. AS YOU CAN SEE the
connection closes when the code is placed in a FOR loop. Does anybody
have an understanding of why this happens?
<addinfourl at 25805288 whose fp = <socket._fileobject object at
0x014083E8>>
Date: Mon, 30 Aug 2004 20:45:40 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12
OpenSSL/0.9.6b DAV/
1.0.3 PHP/4.3.2 mod_perl/1.26
Last-Modified: Sun, 20 Apr 2003 15:19:42 GMT
ETag: "f10f630-9a800-3ea2ba8e"
Accept-Ranges: bytes
Content-Length: 632832
Connection: close
Content-Type: application/msword
<addinfourl at 25807968 whose fp = <socket._fileobject object at
0x01408998>>
Date: Mon, 30 Aug 2004 20:45:40 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12
OpenSSL/0.9.6b DAV/
1.0.3 PHP/4.3.2 mod_perl/1.26
Connection: close
Content-Type: text/html; charset=iso-8859-1
More information about the Python-list
mailing list