Page MenuHomePhabricator

Problem in pywikibot.showDiff not working anymore!
Closed, DuplicatePublic

Description

There's an issue with the latest revision of pywikibot in pywikibot.showDiff, that wasn't there a few days ago (yesterday?). Easy to replicate:

import pywikibot
pywikibot.showDiff("test", "tast")

returns

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pywikibot/__init__.py", line 681, in showDiff
    PatchManager(oldtext, newtext, context=context).print_hunks()
  File "pywikibot/tools/__init__.py", line 1327, in wrapper
    return obj(*__args, **__kw)
  File "pywikibot/diff.py", line 264, in __init__
    hunk = Hunk(self.a, self.b, group)
  File "pywikibot/diff.py", line 69, in __init__
    self.diff_text = u''.join(self.format_diff())
  File "pywikibot/diff.py", line 128, in format_diff
    yield self.color_line(l1, l2)
  File "pywikibot/diff.py", line 164, in color_line
    char, self.colors[color])
  File "pywikibot/tools/formatter.py", line 170, in color_format
    return _ColorFormatter().format(text, *args, **kwargs)
  File "/usr/lib/python2.7/string.py", line 545, in format
    return self.vformat(format_string, args, kwargs)
  File "pywikibot/tools/formatter.py", line 152, in vformat
    kwargs)
  File "/usr/lib/python2.7/string.py", line 549, in vformat
    result = self._vformat(format_string, args, kwargs, used_args, 2)
  File "pywikibot/tools/formatter.py", line 125, in _vformat
    result = super(_ColorFormatter, self)._vformat(*args, **kwargs)
  File "/usr/lib/python2.7/string.py", line 571, in _vformat
    obj, arg_used = self.get_field(field_name, args, kwargs)
  File "/usr/lib/python2.7/string.py", line 632, in get_field
    obj = self.get_value(first, args, kwargs)
  File "pywikibot/tools/formatter.py", line 82, in get_value
    return super(_ColorFormatter, self).get_value(key, args, kwargs)
  File "/usr/lib/python2.7/string.py", line 591, in get_value
    return kwargs[key]
KeyError: u'color'

Event Timeline

totoazero raised the priority of this task from to Needs Triage.
totoazero updated the task description. (Show Details)
totoazero added a project: Pywikibot-General.
totoazero subscribed.

btw, version is: Pywikibot: [https] r-pywikibot-core.git (ec91fd8, g6770, 2015/11/11, 18:40:40, ok)