Page MenuHomePhabricator

Return gracefully from pwb.find_alternates if a folder does not exits
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • add a not existent folder to user_scripts config variable
  • run any script which is not inside the scripts folder

What happens?:

ERROR: checkvotes.py not found! Misspelling?
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pwb.py", line 503, in <module>
    main()
  File "C:\pwb\GIT\core\pwb.py", line 487, in main
    if not execute():
  File "C:\pwb\GIT\core\pwb.py", line 434, in execute
    filename = find_filename(filename)
  File "C:\pwb\GIT\core\pwb.py", line 409, in find_filename
    return find_alternates(filename, path_list)
  File "C:\pwb\GIT\core\pwb.py", line 311, in find_alternates
    for script_name in folder.iterdir():
  File "C:\Python310\lib\pathlib.py", line 1015, in iterdir
    for name in self._accessor.listdir(self):
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht finden: 'C:\\pwb\\GIT\\core\\xqbot'
CRITICAL: Exiting due to uncaught exception <class 'FileNotFoundError'>

What should have happened instead?:
Print a warning that the folder does not exists and continue with the next folder

Event Timeline

Xqt triaged this task as Medium priority.May 21 2022, 10:49 AM

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

[pywikibot/core@master] [bugfix] Return gracefully from pwb.find_alternates if a folder does not exits

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

Change 794469 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Return gracefully from pwb.find_alternates if a folder does not exits

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