MisterSynergy created this task. MisterSynergy added a project: Pywikibot. Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION I am trying to delete an instance of pywikibot.ItemPage using the delete <https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.page.html?highlight=pywikibot%20basepage%20delete#pywikibot.page.BasePage.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 <https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/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). TASK DETAIL https://phabricator.wikimedia.org/T278659 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: MisterSynergy Cc: Aklapper, pywikibot-bugs-list, MisterSynergy, Jyoo1011, JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________ pywikibot-bugs mailing list pywikibot-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs