Page MenuHomePhabricator

Scripts using pywikibot.editor.TextEditor raises AttributeError with Python 3.8
Closed, ResolvedPublic

Description

Example: showing [d]isambiguation page in solve_disambig.py raises AttributeError with Python 3.8

>>> Sankt Andreasberg <<<
n ===
Sankt Andreasberg ist Handlungsort der ARD-Krimireihe [[Harter Brocken]].

== Wirtschaft und Infrastruktur ==
=== Energieversorgung
Option (<number> [1-5], r<number> [1-5], [s]kip link, [e]dit page, [n]ext
page, [u]nlink, [m]ore context, show [d]isambiguation page, [l]ist, [a]dd
new, [q]uit): Page [[Moritz Führmann]] saved
d

0 pages read
0 pages written
0 pages skipped
Execution time: 169 seconds
Script terminated by exception:

ERROR: TypeError: GetHighlight() got an unexpected keyword argument 'fgBg'
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pwb.py", line 325, in <module>
    if not main():
  File "C:\pwb\GIT\core\pwb.py", line 320, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\GIT\core\pwb.py", line 100, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\solve_disambiguation.py", line 1306, in <module>
    main()
  File ".\scripts\solve_disambiguation.py", line 1302, in main
    bot.run()
  File "C:\pwb\GIT\core\pywikibot\bot.py", line 1532, in run
    self.treat(page)
  File ".\scripts\solve_disambiguation.py", line 1211, in treat
    self.treat_links(refPage, page)
  File ".\scripts\solve_disambiguation.py", line 749, in treat_links
    treat_result = self.treat_disamb_only(refPage, page)
  File ".\scripts\solve_disambiguation.py", line 903, in treat_disamb_only
    answer = pywikibot.input_choice('Option', options,
  File "C:\pwb\GIT\core\pywikibot\bot.py", line 512, in input_choice
    return ui.input_choice(question, answers, default, return_shortcut,
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\terminal_interface_base.py", line 386, in input_choice
    answer = option.result(answer)
  File ".\scripts\solve_disambiguation.py", line 579, in result
    editor.edit(self._page.text,
  File "C:\pwb\GIT\core\pywikibot\editor.py", line 127, in edit
    return pywikibot.ui.editText(
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\terminal_interface_base.py", line 459, in editText
    editor = gui.EditBoxWindow()
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\gui.py", line 275, in __init__
    self.editbox = MultiCallCreator(TextEditor)(self, **kwargs)
  File "C:\Python38\lib\idlelib\multicall.py", line 326, in __init__
    widget.__init__(self, *args, **kwargs)
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\gui.py", line 66, in __init__
    'foreground': idleConf.GetHighlight(
TypeError: GetHighlight() got an unexpected keyword argument 'fgBg'
CRITICAL: Exiting due to uncaught exception <class 'TypeError'>
Exception ignored in: <function MultiCallCreator.<locals>.MultiCall.__del__ at 0x000001C5AFB14700>
Traceback (most recent call last):
  File "C:\Python38\lib\idlelib\multicall.py", line 403, in __del__
    for virtual in self.__eventinfo:
AttributeError: 'MultiCall' object has no attribute '_MultiCall__eventinfo'

Details

Related Gerrit Patches:
pywikibot/core : master[bugfix] Fix gui settings

Event Timeline

Xqt created this task.Dec 20 2019, 9:46 AM
Restricted Application added a project: Pywikibot. · View Herald TranscriptDec 20 2019, 9:46 AM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript
Xqt renamed this task from Showing [d]isambiguation page in solve_disambig.py fails with AttributeError to Showing [d]isambiguation page in solve_disambig.py raises AttributeError with Python 3.8.Dec 20 2019, 9:47 AM
Xqt triaged this task as Medium priority.
Xqt claimed this task.Dec 20 2019, 11:13 AM

Change 559760 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Fix gui settings

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

Xqt renamed this task from Showing [d]isambiguation page in solve_disambig.py raises AttributeError with Python 3.8 to Scripts using pywikibot.editor.TextEditor raises AttributeError with Python 3.8.Dec 20 2019, 12:55 PM
Xqt updated the task description. (Show Details)
Xqt raised the priority of this task from Medium to High.Dec 20 2019, 12:57 PM

Same problem with editarticle.py:

C:\pwb\GIT\core>pwb editarticle user:xqt/Test
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pwb.py", line 325, in <module>
    if not main():
  File "C:\pwb\GIT\core\pwb.py", line 320, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\GIT\core\pwb.py", line 100, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\editarticle.py", line 129, in <module>
    main()
  File ".\scripts\editarticle.py", line 125, in main
    app.run()
  File ".\scripts\editarticle.py", line 100, in run
    new = text_editor.edit(old)
  File "C:\pwb\GIT\core\pywikibot\editor.py", line 127, in edit
    return pywikibot.ui.editText(
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\terminal_interface_base.py", line 459, in editText
    editor = gui.EditBoxWindow()
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\gui.py", line 275, in __init__
    self.editbox = MultiCallCreator(TextEditor)(self, **kwargs)
  File "C:\Python38\lib\idlelib\multicall.py", line 326, in __init__
    widget.__init__(self, *args, **kwargs)
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\gui.py", line 66, in __init__
    'foreground': idleConf.GetHighlight(
TypeError: GetHighlight() got an unexpected keyword argument 'fgBg'
CRITICAL: Exiting due to uncaught exception <class 'TypeError'>
Exception ignored in: <function MultiCallCreator.<locals>.MultiCall.__del__ at 0x00000204A11FD9D0>
Traceback (most recent call last):
  File "C:\Python38\lib\idlelib\multicall.py", line 403, in __del__
    for virtual in self.__eventinfo:
AttributeError: 'MultiCall' object has no attribute '_MultiCall__eventinfo'

C:\pwb\GIT\core>

Change 559760 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Fix gui settings

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

Xqt closed this task as Resolved.Dec 21 2019, 9:17 AM