Page MenuHomePhabricator

Terminal_interface: transliterating to ascii fails with "Old color format must not be mixed with new"
Closed, ResolvedPublicBUG REPORT

Description

I wanted to do some edits in wikidata. My pywikibot was last updated today via SVN

pwb.py claimit -lang:cs -prefixindex:rozhledna P31 Q1440300

WARNING: ClaimRobot.__init__ set the Bot.site property; this is only needed when the Bot accesses many sites.


>>> Rozhledna <<<
Traceback (most recent call last):
  File "C:\pwb\pywikibot\bot.py", line 1624, in run
    self.treat(page)
  File "C:\pwb\pywikibot\bot.py", line 1878, in treat
    self.current_page = page
  File "C:\pwb\pywikibot\bot.py", line 1346, in current_page
    stdout('\n\n>>> <<lightpurple>>{}<<default>> <<<'
  File "C:\pwb\pywikibot\tools\_deprecate.py", line 399, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\pywikibot\logging.py", line 204, in stdout
    logoutput(msg, *args, level=STDOUT, **kwargs)
  File "C:\pwb\pywikibot\tools\_deprecate.py", line 399, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\pywikibot\logging.py", line 151, in logoutput
    logger.log(level, msg, extra=context, **kwargs)
  File "C:\Python\lib\logging\__init__.py", line 1547, in log
    self._log(level, msg, args, **kwargs)
  File "C:\Python\lib\logging\__init__.py", line 1624, in _log
    self.handle(record)
  File "C:\Python\lib\logging\__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "C:\Python\lib\logging\__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "C:\Python\lib\logging\__init__.py", line 968, in handle
    self.emit(record)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 600, in emit
    self.UI.output(msg, targetStream=self.stream)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 253, in output
    self.flush()
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 262, in flush
    self.stream_output(*args, **kwargs)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 330, in stream_output
    self._print(text, targetStream)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 201, in _print
    raise ValueError('Old color format must not be mixed with new '
ValueError: Old color format must not be mixed with new color format. Found:


>>> <<lightpurple>>Rozhledna (Bard\03{lightyellow}e\03{previous}nai)<<default>> <<<


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\pwb\pwb.py", line 487, in <module>
    main()
  File "C:\pwb\pwb.py", line 471, in main
    if not execute():
  File "C:\pwb\pwb.py", line 454, in execute
    run_python_file(filename, script_args, module)
  File "C:\pwb\pwb.py", line 143, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\claimit.py", line 161, in <module>
    main()
  File ".\scripts\claimit.py", line 157, in main
    bot.run()
  File "C:\pwb\pywikibot\bot.py", line 1711, in run
    super().run()
  File "C:\pwb\pywikibot\bot.py", line 1638, in run
    self.exit()
  File "C:\pwb\pywikibot\bot.py", line 1492, in exit
    pywikibot.output('\n{read} pages read'
  File "C:\pwb\pywikibot\tools\_deprecate.py", line 399, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\pywikibot\logging.py", line 169, in info
    logoutput(msg, *args, **kwargs)
  File "C:\pwb\pywikibot\tools\_deprecate.py", line 399, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\pywikibot\logging.py", line 151, in logoutput
    logger.log(level, msg, extra=context, **kwargs)
  File "C:\Python\lib\logging\__init__.py", line 1547, in log
    self._log(level, msg, args, **kwargs)
  File "C:\Python\lib\logging\__init__.py", line 1624, in _log
    self.handle(record)
  File "C:\Python\lib\logging\__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "C:\Python\lib\logging\__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "C:\Python\lib\logging\__init__.py", line 968, in handle
    self.emit(record)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 600, in emit
    self.UI.output(msg, targetStream=self.stream)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 253, in output
    self.flush()
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 262, in flush
    self.stream_output(*args, **kwargs)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 330, in stream_output
    self._print(text, targetStream)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 201, in _print
    raise ValueError('Old color format must not be mixed with new '
ValueError: Old color format must not be mixed with new color format. Found:


>>> <<lightpurple>>Rozhledna (Bard\03{lightyellow}e\03{previous}nai)<<default>> <<<

Exception ignored in atexit callback: <bound method UI.flush of <pywikibot.userinterfaces.terminal_interface_win32.Win32UI object at 0x0000024AE08CC0A0>>
Traceback (most recent call last):
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 262, in flush
    self.stream_output(*args, **kwargs)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 330, in stream_output
    self._print(text, targetStream)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 201, in _print
    raise ValueError('Old color format must not be mixed with new '
ValueError: Old color format must not be mixed with new color format. Found:


>>> <<lightpurple>>Rozhledna (Bard\03{lightyellow}e\03{previous}nai)<<default>> <<<

Exception ignored in atexit callback: <function flush at 0x0000024AE06BF520>
Traceback (most recent call last):
  File "C:\pwb\pywikibot\comms\http.py", line 85, in flush
    critical('Exiting due to uncaught exception {}'.format(sys.last_type))
  File "C:\pwb\pywikibot\tools\_deprecate.py", line 399, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\pywikibot\logging.py", line 272, in critical
    logoutput(msg, *args, level=CRITICAL, **kwargs)
  File "C:\pwb\pywikibot\tools\_deprecate.py", line 399, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\pywikibot\logging.py", line 151, in logoutput
    logger.log(level, msg, extra=context, **kwargs)
  File "C:\Python\lib\logging\__init__.py", line 1547, in log
    self._log(level, msg, args, **kwargs)
  File "C:\Python\lib\logging\__init__.py", line 1624, in _log
    self.handle(record)
  File "C:\Python\lib\logging\__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "C:\Python\lib\logging\__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "C:\Python\lib\logging\__init__.py", line 968, in handle
    self.emit(record)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 600, in emit
    self.UI.output(msg, targetStream=self.stream)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 253, in output
    self.flush()
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 262, in flush
    self.stream_output(*args, **kwargs)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 330, in stream_output
    self._print(text, targetStream)
  File "C:\pwb\pywikibot\userinterfaces\terminal_interface_base.py", line 201, in _print
    raise ValueError('Old color format must not be mixed with new '
ValueError: Old color format must not be mixed with new color format. Found:


>>> <<lightpurple>>Rozhledna (Bard\03{lightyellow}e\03{previous}nai)<<default>> <<<


C:\pwb>

Event Timeline

This comment was removed by Xqt.
Xqt triaged this task as High priority.

I was able to reproduce it. You have `transliteration_target = 'ascii' enabled in your user-config.py. This is a good idea if working with foreign languages to get unicode chars transliterated to ascii but these are marked in yelllow. I will make a patch soon. Are you using master or stable branch?
`

Xqt renamed this task from Terminal_interface: Old color format must not be mixed with new to Terminal_interface: transliterating to ascii fails with "Old color format must not be mixed with new".May 4 2022, 3:00 PM

Change 789191 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] do not use old color format for transliterated chars

https://gerrit.wikimedia.org/r/789191

Change 789191 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] do not use old color format for transliterated chars

https://gerrit.wikimedia.org/r/789191