Meno25 created this task.
Meno25 added projects: Pywikibot, Pywikibot-Scripts, 
Pywikibot-cosmetic-changes.py.
Restricted Application added subscribers: pywikibot-bugs-list, alaa, Aklapper.

TASK DESCRIPTION
  **Command line:**
  
    python pwb.py cosmetic_changes -page:"نقاش:ورق بردى" -lang:arz
  
  **Output:**
  
    ERROR: 'NoneType' object has no attribute 'groups' (AttributeError)
    Traceback (most recent call last):
      File "C:\Users\Mohammed\Downloads\core\pwb.py", line 39, in <module>
        sys.exit(main())
                 ^^^^^^
      File "C:\Users\Mohammed\Downloads\core\pwb.py", line 35, in main
        runpy.run_path(str(path), run_name='__main__')
      File "<frozen runpy>", line 291, 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 513, in <module>
        main()
      File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", 
line 497, in main
        if not execute():
               ^^^^^^^^^
      File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", 
line 484, in execute
        run_python_file(filename, script_args, module)
      File "C:\Users\Mohammed\Downloads\core\pywikibot\scripts\wrapper.py", 
line 147, in run_python_file
        exec(compile(source, filename, 'exec', dont_inherit=True),
      File "C:\Users\Mohammed\Downloads\core\scripts\cosmetic_changes.py", line 
131, in <module>
        main()
      File "C:\Users\Mohammed\Downloads\core\scripts\cosmetic_changes.py", line 
127, in main
        bot.run()
      File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1671, in 
run
        self.treat(page)
      File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1924, in 
treat
        self.treat_page()
      File "C:\Users\Mohammed\Downloads\core\scripts\cosmetic_changes.py", line 
84, in treat_page
        new_text = cc_toolkit.change(old_text)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Mohammed\Downloads\core\pywikibot\cosmetic_changes.py", 
line 302, in change
        new_text = self._change(text)
                   ^^^^^^^^^^^^^^^^^^
      File "C:\Users\Mohammed\Downloads\core\pywikibot\cosmetic_changes.py", 
line 296, in _change
        text = self.safe_execute(method, text)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Mohammed\Downloads\core\pywikibot\cosmetic_changes.py", 
line 283, in safe_execute
        result = method(text)
                 ^^^^^^^^^^^^
      File "C:\Users\Mohammed\Downloads\core\pywikibot\cosmetic_changes.py", 
line 712, in removeEmptySections
        next_dep = sections[i + 1].level
                   ^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Mohammed\Downloads\core\pywikibot\textlib.py", line 960, 
in level
        return min(map(len, m.groups()))
                            ^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'groups'
    CRITICAL: Exiting due to uncaught exception AttributeError: 'NoneType' 
object has no attribute 'groups'
  
  **What happens?**
  
  This error happens when the wikitext of the page contains syntax such as:
  
  - Empty header text `====`
  - Comment before the header on the same line `<! -- -->== header text ==`
  
  **What should have happened instead?**:
  
  When encountering such error, the bot should have skipped the page and 
continued working on other pages instead.
  
  **Software version:**
  
    Pywikibot: [https] r-pywikibot-core (ddd39e6, g17979, 2023/07/13, 11:34:35, 
master)
    Release version: 8.3.0.dev0
    setuptools version: 68.0.0
    mwparserfromhell version: 0.6.4
    wikitextparser version: n/a
    requests version: 2.31.0
        certificate test: ok
    Python: 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 
bit (AMD64)]

TASK DETAIL
  https://phabricator.wikimedia.org/T341787

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Meno25
Cc: Aklapper, alaa, pywikibot-bugs-list, Meno25, PotsdamLamb, Jyoo1011, 
JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, 
Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, Xqt, jayvdb, 
Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- pywikibot-bugs@lists.wikimedia.org
To unsubscribe send an email to pywikibot-bugs-le...@lists.wikimedia.org

Reply via email to