I tried to list delete log entries:
from pywikibot.data.api import LogEntryListGenerator gen = LogEntryListGenerator('delete') print(next(gen))
I get a wirning and an error: WARNING: c:\Pywikibot\pywikibot\data\api_generators.py:857: *RuntimeWarning: LogEntryListGenerator invoked without a site* super().__init__('logevents', **kwargs)
Traceback (most recent call last): File "pwb.py", line 39, in <module> sys.exit(main()) File "pwb.py", line 35, in main runpy.run_path(str(path), run_name='__main__') File "C:\Python37\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\Python37\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "pywikibot\scripts\wrapper.py", line 516, in <module> main() File "pywikibot\scripts\wrapper.py", line 500, in main if not execute(): File "pywikibot\scripts\wrapper.py", line 487, in execute run_python_file(filename, script_args, module) File "pywikibot\scripts\wrapper.py", line 148, in run_python_file main_mod.__dict__) File "scripts\userscripts\reasonstat.py", line 141, in <module> main() File "scripts\userscripts\reasonstat.py", line 112, in main print(next(gen)) File "C:\Python37\lib_collections_abc.py", line 317, in __next__ return self.send(None) File "c:\Pywikibot\pywikibot\tools\collections.py", line 275, in send return next(self._started_gen) File "c:\Pywikibot\pywikibot\data\api_generators.py", line 628, in generator yield from self._extract_results(resultdata) File "c:\Pywikibot\pywikibot\data\api_generators.py", line 572, in _extract_results result = self.result(item) File "c:\Pywikibot\pywikibot\data\api_generators.py", line 864, in result return self.entryFactory.create(pagedata) File "c:\Pywikibot\pywikibot\logentries.py", line 339, in create return self._creator(logdata) File "c:\Pywikibot\pywikibot\logentries.py", line 329, in <lambda> self._creator = lambda data: logclass(data, self._site) File "c:\Pywikibot\pywikibot\logentries.py", line 42, in __init__ .format(expected_type, self.type()))
*pywikibot.exceptions.Error: Wrong log type! Expecting delete, received review instead.CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.Error'>*
What's wrong?