Page MenuHomePhabricator

async login produces a lot of errors
Closed, ResolvedPublicBUG REPORT

Description

async login produces a lot of errors; the cookie file is invalid then and can't be used anymore.

pwb login -all -async

WARNING: C:\Python311\Lib\http\cookiejar.py:1977: UserWarning: http.cookiejar bug!
Traceback (most recent call last):
  File "C:\Python311\Lib\http\cookiejar.py", line 1958, in _really_load
    domain_specified = domain.startswith(".")
                       ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'startswith'

  _warn_unhandled_exception()

--- Logging error ---
WARNING: C:\Python311\Lib\http\cookiejar.py:1977: UserWarning: http.cookiejar bug!
Traceback (most recent call last):
  File "C:\Python311\Lib\http\cookiejar.py", line 1959, in _really_load
    c = Cookie(h("version"), name, value,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\http\cookiejar.py", line 774, in __init__
    if version is not None: version = int(version)
                                      ^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'None'

  _warn_unhandled_exception()

Traceback (most recent call last):
  File "C:\Python311\Lib\http\cookiejar.py", line 1958, in _really_load
    domain_specified = domain.startswith(".")
                       ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'startswith'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python311\Lib\logging\handlers.py", line 73, in emit
    if self.shouldRollover(record):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\logging\handlers.py", line 196, in shouldRollover
    msg = "%s\n" % self.format(record)
                   ^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\logging\__init__.py", line 953, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "D:\pwb\core\pywikibot\tools\_logging.py", line 24, in format
    assert len(record.args) == 1, \
           ^^^^^^^^^^^^^^^^^^^^^
AssertionError: Arguments for record is not correctly set
Call stack:
  File "C:\Python311\Lib\threading.py", line 995, in _bootstrap
    self._bootstrap_inner()
  File "C:\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python311\Lib\concurrent\futures\thread.py", line 83, in _worker
    work_item.run()
  File "C:\Python311\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "D:\pwb\core\pywikibot\scripts\login.py", line 101, in login_one_site
    site = pywikibot.Site(code, family)
  File "D:\pwb\core\pywikibot\__init__.py", line 246, in Site
    _sites[key] = interface(code=code, fam=fam, user=user)
  File "D:\pwb\core\pywikibot\site\_apisite.py", line 138, in __init__
    self.login(cookie_only=True)
  File "D:\pwb\core\pywikibot\site\_apisite.py", line 388, in login
    http.cookie_jar.load(self.username(), ignore_discard=True)
  File "D:\pwb\core\pywikibot\comms\http.py", line 84, in load
    super().load(*args, **kwargs)
  File "C:\Python311\Lib\http\cookiejar.py", line 1802, in load
    self._really_load(f, filename, ignore_discard, ignore_expires)
  File "C:\Python311\Lib\http\cookiejar.py", line 1977, in _really_load
    _warn_unhandled_exception()
  File "C:\Python311\Lib\http\cookiejar.py", line 74, in _warn_unhandled_exception
    warnings.warn("http.cookiejar bug!\n%s" % msg, stacklevel=2)
Logged in on wiktionary:kn as Xqbot.
  File "C:\Python311\Lib\warnings.py", line 109, in _showwarnmsg
    sw(msg.message, msg.category, msg.filename, msg.lineno,
Message: 'C:\\Python311\\Lib\\http\\cookiejar.py:1977: UserWarning: http.cookiejar bug!\nTraceback (most recent call last):\n  File "C:\\Python311\\Lib\\http\\cookiejar.py", line 1958, in _really_load\n    domain_specified = domain.startswith(".")\n                       ^^^^^^^^^^^^^^^^^\nAttributeError: \'NoneType\' object has no attribute \'startswith\'\n\n  _warn_unhandled_exception()\n'
Arguments: ()
--- Logging error ---
--- Logging error ---
Traceback (most recent call last):
Traceback (most recent call last):
  File "C:\Python311\Lib\http\cookiejar.py", line 1959, in _really_load
    c = Cookie(h("version"), name, value,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\http\cookiejar.py", line 1958, in _really_load
    domain_specified = domain.startswith(".")
                       ^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\http\cookiejar.py", line 774, in __init__
    if version is not None: version = int(version)
                                      ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'startswith'
ValueError: invalid literal for int() with base 10: 'None'

During handling of the above exception, another exception occurred:


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
Traceback (most recent call last):
  File "C:\Python311\Lib\logging\handlers.py", line 73, in emit
    if self.shouldRollover(record):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\logging\handlers.py", line 73, in emit
    if self.shouldRollover(record):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\logging\handlers.py", line 196, in shouldRollover
    msg = "%s\n" % self.format(record)
                   ^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\logging\handlers.py", line 196, in shouldRollover
    msg = "%s\n" % self.format(record)
                   ^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\logging\__init__.py", line 953, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\logging\__init__.py", line 953, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "D:\pwb\core\pywikibot\tools\_logging.py", line 24, in format
    assert len(record.args) == 1, \
           ^^^^^^^^^^^^^^^^^^^^^
  File "D:\pwb\core\pywikibot\tools\_logging.py", line 24, in format
    assert len(record.args) == 1, \
           ^^^^^^^^^^^^^^^^^^^^^

Event Timeline

Xqt changed the task status from Open to In Progress.Jun 8 2025, 6:50 PM
Xqt claimed this task.
Xqt triaged this task as Medium priority.
Xqt moved this task from Backlog to Login on the Pywikibot board.
Xqt changed the subtype of this task from "Task" to "Bug Report".

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

[pywikibot/core@master] IMPR: use a Lock object in PywikibotCookieJar for thread-safe saving

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

Change #1154444 merged by jenkins-bot:

[pywikibot/core@master] IMPR: use a Lock object in PywikibotCookieJar for thread-safe saving

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