Page MenuHomePhabricator

colors.py: Exiting due to uncaught exception TypeError: 'float' object cannot be interpreted as an integer
Closed, ResolvedPublicBUG REPORT

Description

Command line:

python pwb.py colors

Output:

Traceback (most recent call last):
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 40, in <module>
    sys.exit(main())
             ^^^^^^
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 36, in main
    runpy.run_path(str(path), run_name='__main__')
  File "<frozen runpy>", line 286, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", line 521, in <module>
    main()
  File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", line 505, in main
    if not execute():
           ^^^^^^^^^
  File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", line 492, in execute
    run_python_file(filename, script_args, module)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", line 149, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File "C:\Users\Mohammed\Downloads\core\scripts\maintenance\colors.py", line 46, in <module>
    main()
  File "C:\Users\Mohammed\Downloads\core\scripts\maintenance\colors.py", line 31, in main
    for fg_col_group in batched(fg_colors, n_fg_colors / 4 + 1):
  File "C:\Users\Mohammed\Downloads\core\pywikibot\backports.py", line 195, in batched
    for group in _batched(iterable, n):
                 ^^^^^^^^^^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer
CRITICAL: Exiting due to uncaught exception TypeError: 'float' object cannot be interpreted as an integer

Request:

  • Please fix this TypeError. Thank you.

Software version:

Pywikibot: [https] r-pywikibot-core (2a9399a, g18572, 2024/04/07, 17:39:15, master)
Release version: 9.1.0.dev0
packaging version: 24.0
mwparserfromhell version: 0.6.6
wikitextparser version: n/a
requests version: 2.31.0
    certificate test: ok
Python: 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)]

Event Timeline

Xqt triaged this task as High priority.

Change #1017485 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Fix TypeError in colors.py with backports.batched

https://gerrit.wikimedia.org/r/1017485

Change #1017485 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Fix TypeError in colors.py with backports.batched

https://gerrit.wikimedia.org/r/1017485