Manual talk:Pywikibot/clean sandbox.py

From mediawiki.org

Content is now mandatory in some languages although it could not[edit]

We simply could return the English template by default, instead of getting the following errors when the "-text" parameter is missing and the language template undefined in the script (content = {...}).

Error 'NoneType' is not iterable[edit]

For a few months this script returns systematically the same error on every sites, even when Pywikipedia is up-to-date:

Preparing to process sandbox page [[Wiktionnaire:Bac Ă  sable]]
Traceback (most recent call last):
  File "clean_sandbox.py", line 251, in <module>
    main()
  File "clean_sandbox.py", line 245, in main
    bot.run()
  File "clean_sandbox.py", line 183, in run
    subst = 'subst:' in translatedContent
TypeError: argument of type 'NoneType' is not iterable

RuntimeError[edit]

ERROR: No content is given for pages, exiting.
Traceback (most recent call last):
  File "core/pwb.py", line 262, in <module>
    if not main():
  File "core/pwb.py", line 255, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "core/pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File "core/scripts/clean_sandbox.py", line 272, in <module>
    main()
  File "core/scripts/clean_sandbox.py", line 267, in main
    bot = SandboxBot(generator=generator, **opts)
  File "core/scripts/clean_sandbox.py", line 145, in __init__
    raise RuntimeError
RuntimeError
<type 'exceptions.RuntimeError'>
CRITICAL: Closing network session.

JackPotte (talk) 10:00, 1 July 2017 (UTC)Reply