urllib2.urlopen issue

Chris Rebert clp2 at rebertia.com
Wed Jun 24 14:27:12 EDT 2009


On Wed, Jun 24, 2009 at 10:50 AM, David<Wwy58 at yahoo.com> wrote:
> hello,
>
> I have a url that is "http://query.directrdr.com/ptrack?
> pid=225&v_url=http://
> www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said".
> If I open it on a browser, I can get its contents without any
> problem.
> However, if I use following code,
>
>
> import urllib2
>
>
> url = 'http://query.directrdr.com/ptrack?pid=225&v_url=http://
> www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said'
>
>
> xml = urllib2.urlopen(url).read()
>
>
> then I get an exception of
>
>
>  File "/usr/lib/python2.5/urllib2.py", line 1082, in do_open
>    raise URLError(err)
> urllib2.URLError: <urlopen error (-2, 'Name or service not known')>

Unable to reproduce with either urllib or urllib2's urlopen(). I get
some XML back without error both ways. Using Python 2.6.2 on Mac OS X.

Cheers,
Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list