Page MenuHomePhabricator

Editing as sysop doesn't work
Open, NormalPublic

Description

In my script, I'm editing all but one page with my sysop account (https://github.com/alkamid/wiktionary/blob/master/addLang.py#L174). (I have actually changed the code to page.save() but the problem persists). I'm getting the following error:

Password for user Alkamid on wiktionary:pl (no characters will be shown): 
Logging in to wiktionary:pl as Alkamid
ERROR: Logged in as 'Alkamid' instead of 'AlkamidBot'. Forcing re-login.

Event Timeline

Alkamid created this task.Oct 6 2015, 9:08 PM
Alkamid raised the priority of this task from to Needs Triage.
Alkamid updated the task description. (Show Details)
Alkamid added a project: Pywikibot.
Alkamid added a subscriber: Alkamid.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptOct 6 2015, 9:08 PM
JAnD triaged this task as Normal priority.Mar 29 2016, 7:29 AM
JAnD added a project: Pywikibot-login.py.
JAnD added a subscriber: JAnD.

Maybe related with T67196

JAnD added a comment.Mar 29 2016, 7:30 AM

Same problem - I need to delete about 150 empty pages

C:\pwb>pwb.py delete -file:bb.txt -summary:"Smazání prázdných kategorií"


>>> Kategorie:Monitoring:Flagicon/AHO <<<
Do you want to delete [[cs:Kategorie:Monitoring:Flagicon/AHO]]? ([y]es, [N]o, [a]ll): a
Password for user JAn Dudík on wikipedia:cs (no characters will be shown):
Logging in to wikipedia:cs as JAn Dudík
ERROR: Logged in as 'JAn Dudík' instead of 'JAnDbot'. Forcing re-login.
Logging in to wikipedia:cs as JAnDbot
ERROR: Logged in as 'JAnDbot' instead of 'JAn Dudík'. Forcing re-login.
Logging in to wikipedia:cs as JAnDbot
WARNING: API error permissiondenied: Permission denied

0 pages read
0 pages written
Execution time: 15 seconds
Script terminated by exception:

ERROR: Error: User JAnDbot not authorized to (un)delete pages on wikipedia:cs wiki.
Traceback (most recent call last):
  File "C:\pwb\pwb.py", line 256, in <module>
    if not main():
  File "C:\pwb\pwb.py", line 250, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File ".\scripts\delete.py", line 168, in <module>
    main()
  File ".\scripts\delete.py", line 160, in main
    bot.run()
  File "C:\pwb\pywikibot\bot.py", line 1595, in run
    super(MultipleSitesBot, self).run()
  File "C:\pwb\pywikibot\bot.py", line 1409, in run
    self.treat(page)
  File "C:\pwb\pywikibot\bot.py", line 1623, in treat
    self.treat_page()
  File ".\scripts\delete.py", line 88, in treat_page
    self.getOption('always'))
  File "C:\pwb\pywikibot\tools\__init__.py", line 1358, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\pywikibot\page.py", line 1747, in delete
    return self.site.deletepage(self, reason)
  File "C:\pwb\pywikibot\site.py", line 1304, in callee
    return fn(self, *args, **kwargs)
  File "C:\pwb\pywikibot\tools\__init__.py", line 1358, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\pywikibot\site.py", line 5105, in deletepage
    raise Error(self._dl_errors[err.code] % errdata)
pywikibot.exceptions.Error: User JAnDbot not authorized to (un)delete pages on wikipedia:cs wiki.
<class 'pywikibot.exceptions.Error'>
CRITICAL: Closing network session.

Thank you, Masti!

Change 341699 had a related patch set uploaded (by Xqt; owner: Masti):
[pywikibot/core] fix relogin issue with admin account

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

Xqt added a subscriber: valhallasw.Mar 9 2017, 4:24 PM
Xqt added a subscriber: Xqt.
Xqt added a comment.Mar 9 2017, 4:39 PM

I am not sure whether the whole test should be removed. It was introduced to solve a bug #2716315 (undetected session termination) when a session terminates unexpectedly while bot is operating,

Xqt added a comment.Mar 12 2017, 1:28 PM

Would be better to use -user option in the command line like:

C:\pwb>pwb.py delete -file:bb.txt -summary:"Smazání prázdných kategorií" -user:JAnD

which ensures that the bot doesn't change to a sysop account by accident.

Xqt moved this task from Backlog to Needs Review on the Pywikibot board.Feb 3 2019, 11:23 AM