I am trying to delete an instance of pywikibot.ItemPage using the delete function. After a recent pywikibot update to the latest version (r-pywikibot-core.git (7961cc8, g14506, 2021/03/26, 18:47:46, master)), my previously perfectly running script crashes and the trackback reads:
Traceback (most recent call last):
File "../pywikibot/pwb.py", line 363, in <module>
if not main():
File "../pywikibot/pwb.py", line 358, in main
file_package)
File "../pywikibot/pwb.py", line 75, in run_python_file
main_mod.__dict__)
File "del_items.py", line 57, in <module>
Qitem.delete(reason=editsummary, prompt=True, mark=False, quit=True)
File "/mnt/nfs/labstore-secondary-tools-home/msyn/pywikibot/pywikibot/page/__init__.py", line 1739, in delete
self.site.deletepage(self, reason)
File "/mnt/nfs/labstore-secondary-tools-home/msyn/pywikibot/pywikibot/site/_decorators.py", line 93, in callee
return fn(self, *args, **kwargs)
File "/mnt/nfs/labstore-secondary-tools-home/msyn/pywikibot/pywikibot/tools/__init__.py", line 1445, in wrapper
return obj(*__args, **__kw)
File "/mnt/nfs/labstore-secondary-tools-home/msyn/pywikibot/pywikibot/site/_apisite.py", line 2073, in deletepage
pageid = int(page)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'ItemPage'
CRITICAL: Exiting due to uncaught exception <class 'TypeError'>I think the problem is that in pywikibot/site/_apisite.py$2069, it checks isinstance(page, pywikibot.Page), which probably evaluates to False as pywikibot.ItemPage does *not* extend pywikibot.Page (it extends pywikibot.BasePage, however).