Parse error for some articles using CDB

15 views
Skip to first unread message

Ajeet Grewal

unread,
May 2, 2012, 1:00:08 PM5/2/12
to mw...@googlegroups.com
Hey guys,

I have the xml dump of wikipedia which I have converted to CDB using mwlib. I get parser errors for some articles. It seems that the "adapted" nuwiki (from cdbwiki) does not have the function "normalize_and_get_image_path", which is needed in templ/magics.py. How do I fix this? I have attached the stack trace below.

=== Stack trace ===
$ mw-parse -c wikidb/wikiconf.txt "Obama" --tb
F u'Obama' 
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/mwlib/apps/__init__.py", line 170, in parse
    a=uparser.parseString(x, raw=raw, wikidb=db)
  File "/Library/Python/2.7/site-packages/mwlib/refine/uparser.py", line 34, in parseString
    input = te.expandTemplates(True)
  File "evaluate.py", line 295, in mwlib.templ.evaluate.Expander.expandTemplates (mwlib/templ/evaluate.c:5932)
  File "evaluate.py", line 282, in mwlib.templ.evaluate.Expander._expand (mwlib/templ/evaluate.c:5569)
  File "evaluate.py", line 28, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1103)
  File "evaluate.py", line 30, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1134)
  File "nodes.py", line 210, in mwlib.templ.nodes.Template.flatten (mwlib/templ/nodes.c:4619)
  File "nodes.py", line 291, in mwlib.templ.nodes.Template._flatten (mwlib/templ/nodes.c:5976)
  File "evaluate.py", line 28, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1103)
  File "evaluate.py", line 30, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1134)
  File "nodes.py", line 210, in mwlib.templ.nodes.Template.flatten (mwlib/templ/nodes.c:4619)
  File "nodes.py", line 291, in mwlib.templ.nodes.Template._flatten (mwlib/templ/nodes.c:5976)
  File "evaluate.py", line 28, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1103)
  File "evaluate.py", line 30, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1134)
  File "nodes.py", line 196, in mwlib.templ.nodes.Variable.flatten (mwlib/templ/nodes.c:4369)
  File "evaluate.py", line 152, in mwlib.templ.evaluate.ArgumentList.get (mwlib/templ/evaluate.c:3360)
  File "evaluate.py", line 28, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1103)
  File "evaluate.py", line 30, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1134)
  File "nodes.py", line 210, in mwlib.templ.nodes.Template.flatten (mwlib/templ/nodes.c:4619)
  File "nodes.py", line 291, in mwlib.templ.nodes.Template._flatten (mwlib/templ/nodes.c:5976)
  File "evaluate.py", line 28, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1103)
  File "evaluate.py", line 30, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1134)
  File "nodes.py", line 72, in mwlib.templ.nodes.IfeqNode.flatten (mwlib/templ/nodes.c:2111)
  File "evaluate.py", line 30, in mwlib.templ.evaluate.flatten (mwlib/templ/evaluate.c:1134)
  File "nodes.py", line 210, in mwlib.templ.nodes.Template.flatten (mwlib/templ/nodes.c:4619)
  File "nodes.py", line 277, in mwlib.templ.nodes.Template._flatten (mwlib/templ/nodes.c:5777)
  File "/Library/Python/2.7/site-packages/mwlib/templ/magics.py", line 563, in __call__
    res = m(args) or ''  # FIXME: catch TypeErros
  File "/Library/Python/2.7/site-packages/mwlib/templ/magics.py", line 444, in IFEXIST
    exists = bool(self.wikidb.normalize_and_get_image_path(name.split(":")[1]))
  File "/Library/Python/2.7/site-packages/mwlib/nuwiki.py", line 339, in __getattr__
    raise AttributeError()
AttributeError

=== End stack trace ===

-- 
Regards,
Ajeet

Ralf Schmitt

unread,
May 8, 2012, 3:02:06 AM5/8/12
to mw...@googlegroups.com
Ajeet Grewal <asgr...@gmail.com> writes:

> Hey guys,
>
> I have the xml dump of wikipedia which I have converted to CDB using mwlib.
> I get parser errors for some articles. It seems that the "adapted" nuwiki
> (from cdbwiki) does not have the function "normalize_and_get_image_path",
> which is needed in templ/magics.py. How do I fix this? I have attached the
> stack trace below.

looks like you need to implement normalize_and_get_image_path. I nearly
removed the cdbwiki implementation from mwlib some time ago. pediapress
doesn't use it anymore, and it looks like it would need a new
maintainer. Anyone volunteering?

--
Cheers
Ralf
Reply all
Reply to author
Forward
0 new messages