This worked fine until I upgrade Mathematica to 10.0.2. Now the code suddenly stop working. It seems backslash is automatically inserted after certain character in str2 (between “&” and “term”) in newer version. Is there any way to avoid this?
My quick test with 10.0.1 and 10.0.2 gave the same warning messages.
Please send a working notebook (<= 10.0.1), with all needed inputs and outputs to show how the code should work, and a 10.0.2 notebook with identical inputs showing the warning/error messages. Include
Thank you for the reply. I think I upgrade 10.0.2 from 10.0.0. directly. Unfortunately I do not have a machine which runs version 10.0.0., so attached is 9.0 version.
This is older version:
Search
$Version
"9.0 for Mac OS X x86 (64-bit) (December 12, 2012)"
pubMedHit[str_] := Module[{},
str3 = StringReplace[str, " " -> "+"];
str2 = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&\
term=%22" <> str3 <> "%22";
imp = Import[str2, "XML"];
count = Cases[imp, XMLElement["Count", _, _], 3];
count[[All, -1]][[1, 1]] // ToExpression
]
pubMedHit["Sternum"]
10735
This is newer version:
$Version
"10.0 for Mac OS X x86 (64-bit) (December 4, 2014)"
pubMedHit[str_] := Module[{},
str3 = StringReplace[str, " " -> "+"];
str2 = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&\
term=%22" <> str3 <> "%22";
imp = Import[str2, "XML"];
count = Cases[imp, XMLElement["Count", _, _], 3];
count[[All, -1]][[1, 1]] // ToExpression
]
pubMedHit["Sternum"]
$Failed