On Dec 12, 2012, at 8:54 PM, tutor-requ...@python.org wrote:
> Date: Wed, 12 Dec 2012 20:47:58 -0500
> From: Ed Owens <eowens0...@gmx.com>
> To: tutor@python.org
> Subject: [Tutor] reading web page with BeautifulSoup
> Message-ID: <50c933ce.5010...@gmx.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>>>> from urllib2 import urlopen
>>>> page = urlopen('w1.weather.gov/obhistory/KDCA.html')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
>
> line 126, in urlopen
> return _opener.open(url, data, timeout)
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
>
> line 386, in open
> protocol = req.get_type()
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
>
> line 248, in get_type
> raise ValueError, "unknown url type: %s" % self.__original
> ValueError: unknown url type: w1.weather.gov/obhistory/KDCA.html
>>>>
>
> Can anyone see what I'm doing wrong here?
Yes, you should pass the full url, including the scheme:
urlopen('http://w1.weather.gov/obhistory/KDCA.html')
By the way, your subject line would be better if it had something to do with
url, as the problem is completely unrelated to BeautifulSoup :>)
Take care,
Don
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor