I use pwb.py as a wrapper to run scripts. If I do an imagefile.touch(). Since recently this throws a :
File "/home/me/pywikibot/pywikibot/page/__init__.py", line 1459, in touch
summary = i18n.twtranslate(self.site, 'pywikibot-touch')
File "/home/me/pywikibot/pywikibot/tools/__init__.py", line 1790, in wrapper
return obj(*__args, **__kw)
File "/home/me/pywikibot/pywikibot/i18n.py", line 721, in twtranslate
% (_messages_package_name, twtitle, __url__))
pywikibot.i18n.TranslationError: Unable to load messages package scripts.i18n for bundle pywikibot-touch
It can happen due to lack of i18n submodule or files. See https://www.mediawiki.org/wiki/Manual:Pywikibot/i18n
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.i18n.TranslationError'>This used to work until quite recently. Just python directly is no problem
>>> import pywikibot >>> site = pywikibot.Site('commons', 'commons') >>> imagefile = pywikibot.FilePage(site, title='File:Jan_Steen_-_The_Drawing_Lesson_-_83.PB.388_-_J._Paul_Getty_Museum.jpg') >>> imagefile.touch() Page [[commons:File:Jan Steen - The Drawing Lesson - 83.PB.388 - J. Paul Getty Museum.jpg]] saved >>>
If I throw these 4 lines in a file and run it:
$ python3 pwb.py ~/temp/touch_i18n.problem.py I get the exception.
Using the latest git version of pywikibot and the i18n part:
Pywikibot: [ssh] pywikibot-core.git (0a544a2, g12235, 2020/04/04, 15:23:52, ok)
Probably recently the logic of pwb.py got altered a bit?