Page MenuHomePhabricator

fixing_redirects.py: uncaught exception <class 'ValueError'>
Closed, ResolvedPublic

Description

Command line:

python pwb.py fixing_redirects -lang:ary -page:"أوديت نارايان"

Output:

Script terminated by exception:

ERROR: ValueError: Url: https://www.imdb.com/name/nm$1/
Text / after the $1 placeholder is not supported (T111513).
Traceback (most recent call last):
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 365, in <module>
    if not main():
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 357, in main
    run_python_file(filename,
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 73, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\fixing_redirects.py", line 249, in <module>
    main()
  File ".\scripts\fixing_redirects.py", line 243, in main
    bot.run()
  File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1499, in run
    self.treat(page)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1780, in treat
    self.treat_page()
  File ".\scripts\fixing_redirects.py", line 191, in treat_page
    newtext = self.replace_links(newtext, page, target)
  File ".\scripts\fixing_redirects.py", line 78, in replace_links
    or mysite.isInterwikiLink(m.group('title'))
  File "C:\Users\Mohammed\Downloads\core\pywikibot\site\_basesite.py", line 353, in isInterwikiLink
    linkfam, linkcode = pywikibot.Link(text, self).parse_site()
  File "C:\Users\Mohammed\Downloads\core\pywikibot\page\__init__.py", line 5250, in parse_site
    newsite = self._source.interwiki(prefix)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\site\_apisite.py", line 143, in interwiki
    return self._interwikimap[prefix].site
  File "C:\Users\Mohammed\Downloads\core\pywikibot\site\_interwikimap.py", line 78, in __getitem__
    raise self._iw_sites[prefix].site
  File "C:\Users\Mohammed\Downloads\core\pywikibot\site\_interwikimap.py", line 25, in site
    self._site = pywikibot.Site(
  File "C:\Users\Mohammed\Downloads\core\pywikibot\tools\__init__.py", line 1649, in wrapper
    return obj(*__args, **__kw)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\__init__.py", line 1160, in Site
    code, fam = _code_fam_from_url(url, fam)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\__init__.py", line 1074, in _code_fam_from_url
    code = family.from_url(url)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\family.py", line 844, in from_url
    raise ValueError('Url: {}\nText {} after the $1 placeholder is '
ValueError: Url: https://www.imdb.com/name/nm$1/
Text / after the $1 placeholder is not supported (T111513).
CRITICAL: Exiting due to uncaught exception <class 'ValueError'>

Output of version.py:

Pywikibot: [https] r-pywikibot-core (5aa31e3, g14908, 2021/05/22, 07:29:53, OUTDATED)
Release version: 6.2.0.dev0
requests version: 2.25.1
    certificate test: ok
Python: 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]

Request:

  • Please make the bot skip (and not crash) when encountering such exceptions. This is to save the the time of manually restarting the bot every time it crashes.
  • rPWBC358a887c538af0b69fe6fbcbd57e52a30f777393 has a fix for this issue for solve_disambiguation.py Please implement the same fix for fixing_redirects.py

Event Timeline

Change 693651 had a related patch set uploaded (by Meno25; author: Meno25):

[pywikibot/core@master] fixing_redirects.py: Ignore ValueError

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

Change 693651 merged by jenkins-bot:

[pywikibot/core@master] fixing_redirects.py: Ignore ValueError

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

Meno25 claimed this task.
Meno25 removed a project: Patch-For-Review.