Page MenuHomePhabricator

AttributeError is raised if mwparserfromhell is not installed
Closed, ResolvedPublicBUG REPORT

Description

Problem
If mwparserfromhell is not installed an exception is raised:

C:\pwb\GIT\core>py -3.15 -m pwb version -nouser

No module named 'mwparserfromhell'
Please install it with

    pip install mwparserfromhell
Exception ignored in atexit callback <function flush at 0x000002613132D6F0>:
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pywikibot\comms\http.py", line 126, in flush
    log('Closing network session.')
    ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\pwb\GIT\core\pywikibot\logging.py", line 270, in log
    logoutput(msg, *args, level=VERBOSE, **kwargs)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\pwb\GIT\core\pywikibot\logging.py", line 129, in logoutput
    _init()
    ~~~~~^^
  File "C:\pwb\GIT\core\pywikibot\logging.py", line 77, in _init
    init_routine()
    ~~~~~~~~~~~~^^
  File "C:\pwb\GIT\core\pywikibot\bot.py", line 463, in init_handlers
    writelogheader()
    ~~~~~~~~~~~~~~^^
  File "C:\pwb\GIT\core\pywikibot\bot.py", line 481, in writelogheader
    _log(f'DATE: {pywikibot.Timestamp.nowutc()} UTC')
                  ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pywikibot' has no attribute 'Timestamp'

Proposal
The message should be printed but the exception should pass silenty here.

Event Timeline

Xqt changed the task status from Open to In Progress.Nov 9 2025, 3:51 PM
Xqt claimed this task.
Xqt changed the subtype of this task from "Task" to "Bug Report".

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

[pywikibot/core@master] IMPR: show friendly install message when mandatory packages are missing

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

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

[pywikibot/core@master] IMPR: show friendly install message when mandatory packages are missing

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

Change #1203273 merged by jenkins-bot:

[pywikibot/core@master] IMPR: show friendly install message when mandatory packages are missing

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