Hi there,
I have two separate errors I'm hitting, one parsing a French page, one
parsing a Chinese page. I'll put the error with the French page in a
separate post.
In the Chinese page I'm parsing, the relevant template seems to be:
"template_error/core"
The trace is as follows:
r = parseString(title="", raw=rawText, wikidb=db, lang=ns.code)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/refine/uparser.py", line 34, in parseString
input = te.expandTemplates(True)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/evaluate.py", line 291, in expandTemplates
return self._expand(self.parsed, keep_uniq=keep_uniq)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/evaluate.py", line 278, in _expand
flatten(parsed, self, ArgumentList(expander=self), res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/evaluate.py", line 28, in flatten
flatten(x, expander, variables, res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/evaluate.py", line 30, in flatten
node.flatten(expander, variables, res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/nodes.py", line 205, in flatten
return self._flatten(expander, variables, res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/nodes.py", line 282, in _flatten
flatten(p, expander, var, res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/evaluate.py", line 30, in flatten
node.flatten(expander, variables, res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/nodes.py", line 44, in flatten
flatten(self[2], expander, variables, tmp)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/evaluate.py", line 28, in flatten
flatten(x, expander, variables, res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/evaluate.py", line 30, in flatten
node.flatten(expander, variables, res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/nodes.py", line 205, in flatten
return self._flatten(expander, variables, res)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/nodes.py", line 268, in _flatten
rep = expander.resolver(name, var)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/magics.py", line 559, in __call__
res = m(args) or '' # FIXME: catch TypeErros
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/magics.py", line 209, in wrapper
return f(self, pagename)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/templ/magics.py", line 254, in NAMESPACE
ns, partial, full = self.nshandler.splitname(pagename)
File "/usr/local/lib/python2.6/dist-packages/mwlib-0.12.14-py2.6-
linux-i686.egg/mwlib/nshandling.py", line 128, in splitname
title = unicode(title, 'utf-8')
TypeError: coercing to Unicode: need string or buffer, tuple found
I've tried to dig into it; the title that's being passed that is
causing the error is an empty tuple. It comes from args. There's a
line in wrapper (magics.py, line 209) that:
if args.args:
pagename = args.args[0]
Now, that args seems to have its first element as an empty tuple
defined in the initialization of an ArgumentList in expander. The
relevant lines (evaluate.py line 72):
class ArgumentList(object):
def __init__(self, args=tuple(), expander=None, variables=None):
self.args = tuple(args)
when the ArgumentList is created by the expander on line 278 of
evaluate.py:
flatten(parsed, self, ArgumentList(expander=self), res)
there's no args kwarg passed, so the first element becomes an empty
tuple. I think there's something wrong in that, but I don't understand
enough about how mwlib works to know why most of the time the
processing works but here that it fails. (it worked on 36000 revisions
from a number of different languages, but it seems that this is beyond
it).
I can't see any interactions with my code, so I don't think I've done
anything wrong.
@Ralf: Thanks so much for the help on the other issue. In the future,
is a problem like this something I should be opening a ticket for, or
is it appropriate/best to use the mailing list?
--
You received this message because you are subscribed to the Google Groups
"mwlib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/mwlib?hl=en.