<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">OK, here is a partial solution based on Entrez.read:</div><div class=""><br class=""></div><div class=""><div class="">from Bio import Entrez</div><div class="">Entrez.email = "<a href="mailto:Your.Name.Here@example.org" class="">Your.Name.Here@example.org</a>"</div><div class="">pmid = '12345'</div><div class="">handle = Entrez.efetch("pubmed", id=str(pmid), retmode="xml")</div><div class="">records = Entrez.read(handle)</div><div class="">print records['PubmedArticle'][0]['MedlineCitation']['Article']['ArticleTitle']</div></div><div class=""><span style="font-family: Menlo; font-size: 11px;" class="">A new granulation method for compressed tablets [proceedings].</span></div><div class=""><br class=""></div><div class="">The title instead of an error message!</div><div class=""><br class=""></div><div class="">So it appears that NCBI has tweaked the data structure. Entrez.parse is still broken and I haven’t quite figured out how to fix it.</div><div class=""><br class=""></div><div class="">Konrad</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 21 Dec 2016, at 09:27, Konrad Koehler <<a href="mailto:konrad.koehler@mac.com" class="">konrad.koehler@mac.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Entrez.parse was written for a reason, to parse complex xml data so that it easy to extract citation data from it. Entrez.read, does indeed work, but the output contains such a complex data structure, it is a non-trivial exercise to parse it.</div><div class=""><br class=""></div><div class="">Entrez.parse was working for a very long time, but is no longer working.  Try the following example from Biopython <a href="http://biopython.org/DIST/docs/api/Bio.Entrez-module.html" class="">documentation</a>:</div><div class=""><br class=""></div><div class=""><div class="">from Bio import Entrez</div><div class="">Entrez.email = "<a href="mailto:Your.Name.Here@example.org" class="">Your.Name.Here@example.org</a>"</div><div class="">handle = Entrez.efetch("pubmed", id="19304878,14630660", retmode="xml")</div><div class="">records = Entrez.parse(handle)</div><div class="">for record in records:</div><div class="">    print(record['MedlineCitation']['Article']['ArticleTitle’])</div></div><div class=""><br class=""></div><div class="">Traceback (most recent call last):<br class="">  File "<stdin>", line 1, in <module><br class="">  File "/Users/user/anaconda/lib/python2.7/site-packages/Bio/Entrez/Parser.py", line 302, in parse<br class="">    raise ValueError("The XML file does not represent a list. Please use Entrez.read instead of Entrez.parse")<br class="">ValueError: The XML file does not represent a list. Please use Entrez.read instead of Entrez.parse<br class=""><br class=""></div><div class="">I have reproduced this error on Mac OS X and also a Linux machine.  Peter has also reproduced the problem.</div><div class=""><br class=""></div><div class="">Can you rewrite the above example so that it works with Entrez.read to print out the “ArticleTitle” data?  A better solution of course is to fix Entrez.parse.  I have tried myself to fix this problem, but I am stumped.</div><div class=""><br class=""></div><div class="">Konrad</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On 21 Dec 2016, at 08:47, Michiel de Hoon <<a href="mailto:mjldehoon@yahoo.com" class="">mjldehoon@yahoo.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10px;" class=""><div id="yui_3_16_0_ym19_1_1482306275700_10798" class="">In what sense is the current result from Entrez.read more difficult to parse than the previous result from Entrez.parse?</div><div id="yui_3_16_0_ym19_1_1482306275700_10857" class="">As far as I can tell, Entrez.read and Entrez.parse are both working correctly.</div><div id="yui_3_16_0_ym19_1_1482306275700_10868" class="">Best,</div><div id="yui_3_16_0_ym19_1_1482306275700_10884" class="">-Michiel<br class=""></div><div class="qtdSeparateBR"><br class=""><br class=""></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10px;" class=""> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" class=""> <div dir="ltr" class=""><font face="Arial" size="2" class=""> On Tuesday, December 20, 2016 1:43 PM, Konrad Koehler <<a href="mailto:konrad.koehler@mac.com" class="">konrad.koehler@mac.com</a>> wrote:<br class=""></font></div>  <br class=""><br class=""> <div class="y_msg_container"><div id="yiv3921693084" class=""><div class=""><div class="yiv3921693084" style="margin-bottom:16px;color:rgb(51, 51, 51);font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:14px;margin-top:0px !important;">Then how does one parse the output? Entrez.parse used to work, but no longer. Apparently NCBI has made changes to their xml that has broken Entrez.parse. Entrez.read returns a complex data structure that is difficult to parse.</div><div class="yiv3921693084" style="margin-top:0px;margin-bottom:16px;color:rgb(51, 51, 51);font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:14px;">If one adds "['PubmedArticle']" to line 302 of /Bio/Entrez/Parse.py so that it reads:</div><div class="yiv3921693084" style="margin-top:0px;margin-bottom:16px;color:rgb(51, 51, 51);font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:14px;">records = self.stack[0]['PubmedArticle']</div><div class="yiv3921693084" style="margin-top:0px;color:rgb(51, 51, 51);font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:14px;margin-bottom:0px !important;">this suppresses the error message, but it mysteriously returns only the strings "PubmedArticle" and "PubmedBookArticle" and not the citation. Any ideas?</div><div class="yiv3921693084" style="margin-top:0px;color:rgb(51, 51, 51);font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:14px;margin-bottom:0px !important;"><br class="yiv3921693084" clear="none"></div><div class="yiv3921693084" style="margin-top:0px;color:rgb(51, 51, 51);font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:14px;margin-bottom:0px !important;">Konrad</div><div class="yiv3921693084" style="margin-top:0px;color:rgb(51, 51, 51);font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:14px;margin-bottom:0px !important;"><br class="yiv3921693084" clear="none"></div><div class="yiv3921693084yqt7681181057" id="yiv3921693084yqt08566"><div class=""><blockquote class="yiv3921693084" type="cite"><div class="yiv3921693084">On 20 Dec 2016, at 05:16, Michiel de Hoon <<a rel="nofollow" shape="rect" class="yiv3921693084" ymailto="mailto:mjldehoon@yahoo.com" target="_blank" href="mailto:mjldehoon@yahoo.com">mjldehoon@yahoo.com</a>> wrote:</div><br class="yiv3921693084Apple-interchange-newline" clear="none"><div class="yiv3921693084"><div class="yiv3921693084"><div class="yiv3921693084" style="background-color:rgb(255, 255, 255);font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><div class="yiv3921693084" id="yiv3921693084yui_3_16_0_ym19_1_1482206854351_13850"><span class="yiv3921693084">Entrez.read works for me for the example shown.</span></div><div class="yiv3921693084" id="yiv3921693084yui_3_16_0_ym19_1_1482206854351_13898"><br class="yiv3921693084" clear="none"><span class="yiv3921693084"></span></div><div class="yiv3921693084" id="yiv3921693084yui_3_16_0_ym19_1_1482206854351_13899"><span class="yiv3921693084">Best,</span></div><div class="yiv3921693084" id="yiv3921693084yui_3_16_0_ym19_1_1482206854351_13900"><span class="yiv3921693084">-Michiel</span></div> <div class="yiv3921693084qtdSeparateBR"><br class="yiv3921693084" clear="none"><br class="yiv3921693084" clear="none"></div><div class="yiv3921693084yahoo_quoted" style="display:block;"> <div class="yiv3921693084" style="font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10px;"> <div class="yiv3921693084" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div class="yiv3921693084" dir="ltr"><font class="yiv3921693084" face="Arial" size="2"> On Sunday, December 18, 2016 11:57 AM, Peter Cock <<a rel="nofollow" shape="rect" class="yiv3921693084" ymailto="mailto:p.j.a.cock@googlemail.com" target="_blank" href="mailto:p.j.a.cock@googlemail.com">p.j.a.cock@googlemail.com</a>> wrote:<br class="yiv3921693084" clear="none"></font></div>  <br class="yiv3921693084" clear="none"><br class="yiv3921693084" clear="none"> <div class="yiv3921693084y_msg_container">On Sun, Dec 18, 2016 at 2:50 AM, Peter Cock <<a rel="nofollow" shape="rect" class="yiv3921693084" ymailto="mailto:p.j.a.cock@googlemail.com" target="_blank" href="mailto:p.j.a.cock@googlemail.com">p.j.a.cock@googlemail.com</a>> wrote:<br class="yiv3921693084" clear="none">> On Thu, Dec 15, 2016 at 7:37 PM, Konrad Koehler <<a rel="nofollow" shape="rect" class="yiv3921693084" ymailto="mailto:konrad.koehler@mac.com" target="_blank" href="mailto:konrad.koehler@mac.com">konrad.koehler@mac.com</a>> wrote:<br class="yiv3921693084" clear="none">>> Hello everyone,<br class="yiv3921693084" clear="none">>><br class="yiv3921693084" clear="none">>> I have been using Entrez.parse for years without any errors.  However just<br class="yiv3921693084" clear="none">>> in the last day or two, it stopped working.  I have been able to reproduce<br class="yiv3921693084" clear="none">>> the error using the following example from the biopython Package Entrez<br class="yiv3921693084" clear="none">>> documentation:<br class="yiv3921693084" clear="none">>><br class="yiv3921693084" clear="none">><br class="yiv3921693084" clear="none">> I can reproduce this. The XML looks sensible, two <PubmedArticle><br class="yiv3921693084" clear="none">> tags:<br class="yiv3921693084" clear="none">><br class="yiv3921693084" clear="none">> <?xml version="1.0" ?><br class="yiv3921693084" clear="none">> <!DOCTYPE PubmedArticleSet PUBLIC "-//NLM//DTD PubMedArticle, 1st<br class="yiv3921693084" clear="none">> January 2017//EN"<br class="yiv3921693084" clear="none">> "<a rel="nofollow" shape="rect" class="yiv3921693084" target="_blank" href="https://dtd.nlm.nih.gov/ncbi/pubmed/out/pubmed_170101.dtd">https://dtd.nlm.nih.gov/ncbi/pubmed/out/pubmed_170101.dtd</a>"><br class="yiv3921693084" clear="none">> <PubmedArticleSet><br class="yiv3921693084" clear="none">> <PubmedArticle><br class="yiv3921693084" clear="none">>     <MedlineCitation Status="MEDLINE" Owner="NLM"><br class="yiv3921693084" clear="none">>         <PMID Version="1">19304878</PMID><br class="yiv3921693084" clear="none">>         ...<br class="yiv3921693084" clear="none">>     </MedlineCitation><br class="yiv3921693084" clear="none">>     <PubmedData><br class="yiv3921693084" clear="none">>        ...<br class="yiv3921693084" clear="none">>     </PubmedData><br class="yiv3921693084" clear="none">> </PubmedArticle><br class="yiv3921693084" clear="none">> <PubmedArticle><br class="yiv3921693084" clear="none">>     <MedlineCitation Status="MEDLINE" Owner="NLM"><br class="yiv3921693084" clear="none">>         <PMID Version="1">14630660</PMID><br class="yiv3921693084" clear="none">>         ...<br class="yiv3921693084" clear="none">>     </MedlineCitation><br class="yiv3921693084" clear="none">>     <PubmedData><br class="yiv3921693084" clear="none">>         ...<br class="yiv3921693084" clear="none">>     </PubmedData><br class="yiv3921693084" clear="none">> </PubmedArticle><br class="yiv3921693084" clear="none">> </PubmedArticleSet><br class="yiv3921693084" clear="none">><br class="yiv3921693084" clear="none">> Note however it is using a new DTD file for Jan 2017,<br class="yiv3921693084" clear="none">><br class="yiv3921693084" clear="none">> <a rel="nofollow" shape="rect" class="yiv3921693084" target="_blank" href="https://dtd.nlm.nih.gov/ncbi/pubmed/out/pubmed_170101.dtd">https://dtd.nlm.nih.gov/ncbi/pubmed/out/pubmed_170101.dtd</a><br class="yiv3921693084" clear="none">><br class="yiv3921693084" clear="none">><br class="yiv3921693084" clear="none">>> Does anyone have any suggestions on how to get Entrez.parse working again? I<br class="yiv3921693084" clear="none">>> am also curious why this stopped working.  Has the NCBI server changed?<br class="yiv3921693084" clear="none">>><br class="yiv3921693084" clear="none">><br class="yiv3921693084" clear="none">> I would guess that the NCBI changed something subtly. Michiel?<br class="yiv3921693084" clear="none">><br class="yiv3921693084" clear="none">> Peter<br class="yiv3921693084" clear="none"><br class="yiv3921693084" clear="none">Logged on GitHub,<br class="yiv3921693084" clear="none"><br class="yiv3921693084" clear="none"><a rel="nofollow" shape="rect" class="yiv3921693084" target="_blank" href="https://github.com/biopython/biopython/issues/1027">https://github.com/biopython/biopython/issues/1027</a><div class="yiv3921693084yqt5514597011" id="yiv3921693084yqtfd52192"><br class="yiv3921693084" clear="none"><br class="yiv3921693084" clear="none">Peter<br class="yiv3921693084" clear="none"></div><br class="yiv3921693084" clear="none"><br class="yiv3921693084" clear="none"></div>  </div> </div>  </div></div></div></div></blockquote></div></div><br class="yiv3921693084" clear="none"></div></div><br class=""><br class=""></div>  </div> </div>  </div></div></div></div></blockquote></div><br class=""></div>_______________________________________________<br class="">Biopython mailing list  -  <a href="mailto:Biopython@mailman.open-bio.org" class="">Biopython@mailman.open-bio.org</a><br class=""><a href="http://mailman.open-bio.org/mailman/listinfo/biopython" class="">http://mailman.open-bio.org/mailman/listinfo/biopython</a></div></blockquote></div><br class=""></body></html>