Size of a remote URL

Grant Edwards grante at visi.com
Mon Aug 30 17:05:27 EDT 2004


On 2004-08-30, Justin <justin__devine at hotmail.com> wrote:

> 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

The above chunk of code doesn't even compile.

> 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)

The above code isn't proper Python: it doesn't even compile.

> THIS IS THE CODE RETURNED IN THE CONSOLE.

I've *no* clue what that means.

> 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?

You're going to have to post the _actual_code_you're_running_
if you want helpful responses.

-- 
Grant Edwards                   grante             Yow!  Let me do my TRIBUTE
                                  at               to FISHNET STOCKINGS...
                               visi.com            



More information about the Python-list mailing list