[referencer] Metadata retrival from SciELO
Leonardo F. Fontenelle
leonardof at gnome.org
Sun Nov 30 20:50:53 EST 2008
Em Qui, 2008-08-21 às 23:53 -0300, Leonardo F. Fontenelle escreveu:
> I would like Referencer to be able to retrieve metadata from SciELO
> [http://www.scielo.org], which publishes the full content of many high
> quality scientific Latin American journals.
>
> [...]
>
Lucky me, I do pine for the days when men were men and wrote their own
plugins. This is my first attempt to provide a Referencer plugin to
retreive metadata from SciELO.
Even if I was not able to "import referencer" in the python console, I
tried most of the plugin code before I launched referencer with it. To
my surprise, Referencer gave me this error message:
setting pythonPath
to :./plugins:/home/leonardof/.referencer/plugins:/usr/lib/referencer:
void PluginManager::scan(const std::string&):
found module scielo
void PythonPlugin::printException():
Exceção: <type 'exceptions.SyntaxError'>
Módulo: scielo
Explicação: ('invalid syntax',
('/home/leonardof/.referencer/plugins/scielo.py', 123, 62, ' for node
in metadata_xml.getElementsByTagName("pub-date"):\n'))
virtual void PythonPlugin::load(const std::string&):
Plugin::load: Couldn't import module
The code snippet is:
def resolve_metadata(doc, method):
[...]
xmldoc = minidom.ParseString(xml)
metadata_xml = xmldoc.getElementsByTagName('front')[0]
[...]
>>> for node in metadata_xml.getElementsByTagName("pub-date"): <<<
if node.getAttribute('pub-type') != "pub" : continue
year = node.getElementsByTagName('year')[0].firstChild.data
if year:
doc.set_field('year', year)
else:
print "scielo.resolve_metadata:",
"publication has no printed publication year."
I can't understand what's wrong here; the python console (2.6) doesn't
complain, and there's a similar "for" loop before this one.
I'd appreciate a lot if someone could help me fix this syntax error.
Latter, I'll have a few questions which are more related to referencer
than to python.
Thanks in advance!
--
Leonardo Fontenelle
http://leonardof.org
More information about the referencer
mailing list