Page MenuHomePhabricator

Provide a proper implementation to accept QuitKeyboardInterrupt in specialbots.Uploadbot
Closed, ResolvedPublic

Description

[q]uit option hardly breaks the bot:

No description was given. Add one? ([Y]es, [q]uit): q
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pwb.py", line 263, in <module>
    if not main():
  File "C:\pwb\GIT\core\pwb.py", line 257, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\GIT\core\pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File ".\scripts\upload.py", line 196, in <module>
    main()
  File ".\scripts\upload.py", line 193, in main
    bot.run()
  File "C:\pwb\GIT\core\pywikibot\specialbots.py", line 461, in run
    self.upload_file(file_url)
  File "C:\pwb\GIT\core\pywikibot\specialbots.py", line 392, in upload_file
    filename = self.process_filename(file_url)
  File "C:\pwb\GIT\core\pywikibot\specialbots.py", line 348, in process_filename

    u'No description was given. Add one?', [('Yes', 'y')], default='y')) \
  File "C:\pwb\GIT\core\pywikibot\bot.py", line 448, in input_choice
    automatic_quit=automatic_quit, force=force)
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\terminal_interface_base.py", li
ne 392, in input_choice
    raise answer
pywikibot.bot_choice.QuitKeyboardInterrupt
<class 'pywikibot.bot_choice.QuitKeyboardInterrupt'>
CRITICAL: Closing network session.

Provide the try/except/finally clause inside run method or use the default behaviour from BaseBot

Event Timeline

Xqt triaged this task as High priority.Apr 27 2017, 7:03 AM

Change 351325 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] Accept QuitKeyboardInterrupt in specialbots.Uploadbot

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

Dalba claimed this task.

Change 351325 merged by jenkins-bot:
[pywikibot/core@master] Accept QuitKeyboardInterrupt in specialbots.Uploadbot

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