Page MenuHomePhabricator

pywikibot fails to login as non-default user in Toolforge
Open, HighPublicBUG REPORT

Description

For about two months my bot fails to login as sysop with pywikibot, when run on Toolforge ('edgars' tool, if somebody wants to look around), both with running with jsub and running in cron (so... i guess -grid engine); didn't test the k8s. As i can successfully login on my Windows machine on all recent pywikibot versions, i guess it has something to do with Toolforge?

The issue started in the week between October 19 and October 26. I vaguely remember, that there was similar issue few months ago (September?), but can't find anything in Phab.

Yes, I have botpasswords and no, i don't remember changing it. Running the script as my bot account works fine.

pywikibot version: '5.3.0'

script to reproduce:

import pywikibot

print(pywikibot.__version__)

lvsite = pywikibot.Site("lv", "wikipedia", user='Edgars2007')

pagetosave = pywikibot.Page(lvsite,'Dalībnieks:Edgars2007/Smilšu kaste')
pagetosave.text = 'test'
pagetosave.save(summary='test', botflag=True)

the log:

Logging in to wikipedia:lv as Edgars2007@EdgarsBot
ERROR: Login failed (Aborted).
Password for user Edgars2007@EdgarsBot on wikipedia:lv (no characters will be shown): WARNING: /usr/lib/python3.5/getpass.py:92: GetPassWarning: Can not control echo on the terminal.
  passwd = fallback_getpass(prompt, stream)

Warning: Password input may be echoed.
Traceback (most recent call last):
  File "/data/project/shared/pywikibot/stable/pywikibot/login.py", line 326, in login
    cookiedata = self.getCookie()
  File "/data/project/shared/pywikibot/stable/pywikibot/tools/__init__.py", line 1564, in wrapper
    return obj(*new_args, **new_kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/data/api.py", line 3071, in getCookie
    raise APIError(code=status, info=info)
pywikibot.data.api.APIError: Aborted: Cannot log in when using MediaWiki\Session\BotPasswordSessionProvider sessions.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/getpass.py", line 70, in unix_getpass
    old = termios.tcgetattr(fd)     # a copy to save
termios.error: (25, 'Inappropriate ioctl for device')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pwb/check.py", line 9, in <module>
    pagetosave.save(summary='test', botflag=True)
  File "/data/project/shared/pywikibot/stable/pywikibot/tools/__init__.py", line 1481, in wrapper
    return obj(*__args, **__kw)
  File "/data/project/shared/pywikibot/stable/pywikibot/tools/__init__.py", line 1481, in wrapper
    return obj(*__args, **__kw)
  File "/data/project/shared/pywikibot/stable/pywikibot/page/__init__.py", line 1272, in save
    cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/page/__init__.py", line 138, in wrapper
    handle(func, self, *args, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/page/__init__.py", line 117, in handle
    func(self, *args, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/page/__init__.py", line 1283, in _save
    watch=watch, bot=botflag, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/site/_decorators.py", line 94, in callee
    return fn(self, *args, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/site/__init__.py", line 3402, in editpage
    token = self.tokens['edit']
  File "/data/project/shared/pywikibot/stable/pywikibot/site/_tokenwallet.py", line 52, in __getitem__
    self.site.login()
  File "/data/project/shared/pywikibot/stable/pywikibot/tools/__init__.py", line 1481, in wrapper
    return obj(*__args, **__kw)
  File "/data/project/shared/pywikibot/stable/pywikibot/site/__init__.py", line 334, in login
    if login_manager.login(retry=True, autocreate=autocreate):
  File "/data/project/shared/pywikibot/stable/pywikibot/login.py", line 340, in login
    return self.login(retry=True)
  File "/data/project/shared/pywikibot/stable/pywikibot/login.py", line 321, in login
    password=True)
  File "/data/project/shared/pywikibot/stable/pywikibot/bot.py", line 454, in input
    data = ui.input(question, password=password, default=default, force=force)
  File "/data/project/shared/pywikibot/stable/pywikibot/userinterfaces/terminal_interface_base.py", line 280, in input
    text = self._input_reraise_cntl_c(password)
  File "/data/project/shared/pywikibot/stable/pywikibot/userinterfaces/terminal_interface_base.py", line 298, in _input_reraise_cntl_c
    text = getpass.getpass('')
  File "/usr/lib/python3.5/getpass.py", line 92, in unix_getpass
    passwd = fallback_getpass(prompt, stream)
  File "/usr/lib/python3.5/getpass.py", line 127, in fallback_getpass
    return _raw_input(prompt, stream)
  File "/usr/lib/python3.5/getpass.py", line 149, in _raw_input
    raise EOFError
EOFError
CRITICAL: Exiting due to uncaught exception <class 'EOFError'>