Problem:
- The script fixing_redirects.py crashes when running on any page that has the replacement character in one of the links.
Command line:
python pwb.py fixing_redirects -ignoremoves -page:"دنكن هالداين"
Error:
ERROR: '� ' contains illegal char ' �' (InvalidTitleError)
Traceback:
Traceback (most recent call last): File "C:\Users\Mohammed\Downloads\core\pwb.py", line 39, in <module> sys.exit(main()) ^^^^^^ File "C:\Users\Mohammed\Downloads\core\pwb.py", line 35, in main runpy.run_path(str(path), run_name='__main__') File "<frozen runpy>", line 291, in run_path File "<frozen runpy>", line 98, in _run_module_code File "<frozen runpy>", line 88, in _run_code File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", line 516, in <module> main() File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", line 500, in main if not execute(): ^^^^^^^^^ File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", line 487, in execute run_python_file(filename, script_args, module) File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", line 147, in run_python_file exec(compile(source, filename, 'exec', dont_inherit=True), File "C:\Users\Mohammed\Downloads\core\scripts\fixing_redirects.py", line 264, in <module> main() File "C:\Users\Mohammed\Downloads\core\scripts\fixing_redirects.py", line 258, in main bot.run() File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1702, in run self.treat(page) File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1956, in treat self.treat_page() File "C:\Users\Mohammed\Downloads\core\scripts\fixing_redirects.py", line 205, in treat_page newtext = self.replace_links(newtext, page, target) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Mohammed\Downloads\core\scripts\fixing_redirects.py", line 87, in replace_links is_interwikilink = mysite.isInterwikiLink(m['title']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Mohammed\Downloads\core\pywikibot\site\_basesite.py", line 343, in isInterwikiLink linkfam, linkcode = pywikibot.Link(text, self).parse_site() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Mohammed\Downloads\core\pywikibot\page\_links.py", line 316, in __init__ raise InvalidTitleError( pywikibot.exceptions.InvalidTitleError: '�' contains illegal char '�' CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.InvalidTitleError'>
Request:
- Please make the bot skip the page (and not crash) when encountering such pages. Thank you.
Note:
Output of version.py:
Pywikibot: [https] r-pywikibot-core (8b8c7ec, g17341, 2022/12/03, 15:38:36, master) Release version: 8.0.0.dev0 setuptools version: 65.6.3 mwparserfromhell version: 0.6.4 wikitextparser version: n/a requests version: 2.28.1 certificate test: ok Python: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]