Page MenuHomePhabricator

Editing as sysop doesn't work
Closed, ResolvedPublic

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 raised the priority of this task from to Needs Triage.
Alkamid updated the task description. (Show Details)
Alkamid added a project: Pywikibot.
Alkamid subscribed.
JAnD triaged this task as Medium priority.Mar 29 2016, 7:29 AM
JAnD added a project: Pywikibot-login.py.
JAnD subscribed.

Maybe related with T67196

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.

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

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,

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.

Change 341699 abandoned by Xqt:
fix relogin issue with admin account

Reason:
The behaviour has been changed from group related rights to direct user Rights. There is no dualism of user/sysop anymore

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

Xqt claimed this task.
Xqt removed a project: Patch-For-Review.
Xqt added a subscriber: Huji.

The behaviour has been changed from group related rights to direct user Rights. There is no dualism of user/sysop anymore.

Xqt removed Xqt as the assignee of this task.Jan 12 2020, 1:42 PM