Problem with urllib.urlopen()

Steve Holden sholden at holdenweb.com
Wed Jun 5 08:51:04 EDT 2002


"Christopher" <chris_mk at hotmail.com> wrote in message
news:cc14131d.0206041631.157f11d1 at posting.google.com...
> Okay okay, here are links that 1) are short, 2) should work, and 3)
> show my problem.
>
> link 1:
>
http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=PureSearch&db=PubMed&detai
ls_term=%28%22glucagon%22%5BMeSH%20Terms%5D%20OR%20glucagon%5BText%20Word%5D
%29
>
> link2:
>
>
http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Display&db=PubMed&details_
term=%28%22glucagon%22%5BMeSH%20Terms%5D%20OR%20glucagon%5BText%20Word%5D%29
&dopt=XML&query_key=1
>
> Look at link2 in your browser, then look at what urllib.urlopen or
> .urlretrieve get.  Thanks.
>

Just to be sure, do you expect the second link (in a browser) to show "Error
handling request: no current query"? This seems to work w/Python 2.2 under
cygwin, at least. There was so much output I omitted quite a lot, replaced
by ellipses below:

>>> import urllib
>>> f =
urllib.urlopen("""http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Display&
db=PubMed&details_term=%28%22glucagon%22%5BMeSH%20Terms%5D%20OR%20glucagon%5
BText%20Word%5D%29&dopt=XML&query_key=1""")
>>> ll  = f.read()
>>> ll
'<html>\n  <head> ...
<table
cellpadding="0" cellspacing="0" width="100%"><tr><td bgcolor="#ffcccc">Error
handling request: no current query<BR></td></tr></table> ...
</body>\n</html>\n'
>>>

regards
 Steve
--
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list