urllib2 - iteration over non-sequence

2007-06-09 Thread rplobue
im trying to get urllib2 to work on my server which runs python
2.2.1.  When i run the following code:


import urllib2
for line in urllib2.urlopen('www.google.com'):
  print line


i will always get the error:
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: iteration over non-sequence


Anyone have any answers?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: urllib2 - iteration over non-sequence

2007-06-09 Thread rplobue
Thanks for the reply Larry but I am still having trouble.  If i
understand you correctly, your are just suggesting that i add an http://
in front of the address?  However when i run this:

>>> import urllib2
>>> site = urllib2.urlopen('http://www.google.com')
>>> for line in site:
>>>  print line

I am still getting the message:

TypeError: iteration over non-sequence
  File "", line 1
TypeError: iteration over non-sequence

-- 
http://mail.python.org/mailman/listinfo/python-list