Hi Jean-Frédéric,
I see new_categories = ["B"] in your code. I believe this should be a list of Category objects, not a list of strings.
Maarten
Hi,
In the heritage repo [1], I have pywikibot pinned to 3.0.20180823.
Upgrading to latest version leads to two of my unit tests to fail [2](I’m not 100% sure, but I do believe the same errors popped up last time I tried upgrading in August 2019.)
The unit tests are at [3], the method tested at [4], and the stack trace at [5].
I have been digging a bit in the git history to understand what happened between August 2018 and August 2019 / August 2020 in textlib but nothing jumped.
Would anyone know what the change is caused by, and how I should update my code?
Thanks!
[3] https://phabricator.wikimedia.org/diffusion/THER/browse/master/tests/test_categorization.py$87-103[5] Stack trace:```File "/src/erfgoedbot/categorize_images.py", line 263, in replace_default_cat_with_new_categories_in_image_text page_text_without_base_category, new_categories, addOnly=True) File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", line 1459, in replaceCategoryLinks new_cats = categoryFormat(new, insite=site) File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", line 1552, in categoryFormat category = pywikibot.Category(category) File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", line 1819, in wrapper return obj(*__args, **__kw) File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", line 2879, in __init__ Page.__init__(self, source, title, ns=14) File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", line 1819, in wrapper return obj(*__args, **__kw) File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", line 2392, in __init__ super(Page, self).__init__(source, title, ns) File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", line 221, in __init__ .format(type(source), source)) Error: Invalid argument type '<type 'str'>' in Page initializer: B ```--Jean-Frédéric
_______________________________________________ pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot