Hi all,
on my first steps with Python and Pywikibot, i encounter the following strange error message:
2024-05-3116:23:19__init__.py, 373in _flush: VERBOSE Dropped throttle(s). 2024-05-3116:23:19http.py, 119in flush: VERBOSE Closing network session. 2024-05-3116:23:19http.py, 123in flush: VERBOSE Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\florian\AppData\Roaming\Python\Python312\Scripts\pwb.exe__main__.py", line 7, in <module> sys.exit(run()) ^^^^^ File "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py", line 516, in run if not execute(): ^^^^^^^^^ File "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py", line 492, in execute run_python_file(filename, script_args, module) File "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py", line 149, in run_python_file exec(compile(source, filename, 'exec', dont_inherit=True), File ".\HandleCommonsOnOSMBot.py", line 192, in <module> main() File ".\HandleCommonsOnOSMBot.py", line 188, in main HandleCommonsOnOSMBot(generator=gen_factory.getCombinedGenerator(), **options).run() File "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\bot.py", line 1470, in run self.generator= (item for item in self.generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType'object is not iterable 2024-05-3116:23:19http.py, 132in flush: CRITICALExiting due to uncaught exception TypeError: 'NoneType'object is not iterable 2024-05-3116:23:19http.py, 137in flush: VERBOSE Network session closed.
This error encounters when my script is finished and pywikibot closing the network session. For the complete source code, please see
https://github.com/tohuuuuu/HandleCommonsOnOSMBot/blob/main/HandleCommonsOnO...
I took the part starting with "def main(*args: str) -> None:" from https://doc.wikimedia.org/pywikibot/stable/library_usage.html - maybe this isn't the correct way to use it? Since the bot code works fine, it looks like a minor problem, but i'm curious if i did something wrong.
Cheers
Florian
Hi Florian,
no generator was specified. You should choose one of the pagegenerators option I guess: https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.pagegenerators....
HandleCommonsOnOSMBot(generator=gen_factory.getCombinedGenerator(), **options)
gives just None for the generator attribute.
Best xqt
Am 31.05.2024 um 16:36 schrieb tohuuu th@tohuuu.de:
Hi all,
on my first steps with Python and Pywikibot, i encounter the following strange error message:
2024-05-31 16:23:19 __init__.py, 373 in _flush: VERBOSE Dropped throttle(s). 2024-05-31 16:23:19 http.py, 119 in flush: VERBOSE Closing network session. 2024-05-31 16:23:19 http.py, 123 in flush: VERBOSE Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\florian\AppData\Roaming\Python\Python312\Scripts\pwb.exe__main__.py", line 7, in <module> sys.exit(run()) ^^^^^ File "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py", line 516, in run if not execute(): ^^^^^^^^^ File "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py", line 492, in execute run_python_file(filename, script_args, module) File "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py", line 149, in run_python_file exec(compile(source, filename, 'exec', dont_inherit=True), File ".\HandleCommonsOnOSMBot.py", line 192, in <module> main() File ".\HandleCommonsOnOSMBot.py", line 188, in main HandleCommonsOnOSMBot(generator=gen_factory.getCombinedGenerator(), **options).run() File "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\bot.py", line 1470, in run self.generator = (item for item in self.generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable 2024-05-31 16:23:19 http.py, 132 in flush: CRITICAL Exiting due to uncaught exception TypeError: 'NoneType' object is not iterable 2024-05-31 16:23:19 http.py, 137 in flush: VERBOSE Network session closed.
This error encounters when my script is finished and pywikibot closing the network session. For the complete source code, please see
https://github.com/tohuuuuu/HandleCommonsOnOSMBot/blob/main/HandleCommonsOnO...
I took the part starting with "def main(*args: str) -> None:" from https://doc.wikimedia.org/pywikibot/stable/library_usage.html - maybe this isn't the correct way to use it? Since the bot code works fine, it looks like a minor problem, but i'm curious if i did something wrong.
Cheers
Florian
pywikibot mailing list -- pywikibot@lists.wikimedia.org Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/me... To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org