urllib2.urlopen issue

David Wwy58 at yahoo.com
Wed Jun 24 14:59:29 EDT 2009


On Jun 24, 11:27 am, Chris Rebert <c... at rebertia.com> wrote:
> On Wed, Jun 24, 2009 at 10:50 AM, David<Ww... 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- Hide quoted text -
>
> - Show quoted text -

Thanks Aahz. And thanks Chris. The XML content is what I am looking
for. I use Python 2.5. Maybe I should update to 2.6.2? Python version
problem?



More information about the Python-list mailing list