Python error when using urllib.open

Alan picture Alan · Mar 1, 2009 · Viewed 32.2k times · Source

When I run this:

import urllib

feed = urllib.urlopen("http://www.yahoo.com")

print feed

I get this output in the interactive window (PythonWin):

<addinfourl at 48213968 whose fp = <socket._fileobject object at 0x02E14070>>

I'm expecting to get the source of the above URL. I know this has worked on other computers (like the ones at school) but this is on my laptop and I'm not sure what the problem is here. Also, I don't understand this error at all. What does it mean? Addinfourl? fp? Please help.

Answer

RexE picture RexE · Mar 1, 2009

Try this:

print feed.read()

See Python docs here.