Page MenuHomePhabricator

as_group='sysop' not working properly
Closed, ResolvedPublic

Description

I'm running my script (which uses pywikibot to save pages) on tools and when it reaches the save(..., as_group='sysop') part, I'm prompted for my sysop password:

Logging in to wiktionary:pl as Alkamid
ERROR: Login failed (WrongPass).
Password for user Alkamid on wiktionary:pl (no characters will be shown):

When I enter the password, the following happens:

Logging in to wiktionary:pl as Alkamid
ERROR: Logged in as 'Alkamid' instead of 'AlkamidBot'. Forcing re-login.
Logging in to wiktionary:pl as AlkamidBot
ERROR: Logged in as 'AlkamidBot' instead of 'Alkamid'. Forcing re-login.
Logging in to wiktionary:pl as AlkamidBot
WARNING: API error protectednamespace-interface: You're not allowed to edit interface messages
Traceback (most recent call last):
  File "/shared/pywikipedia/core/pywikibot/page.py", line 1125, in _save
    watch=watch, bot=botflag, **kwargs)
  File "/shared/pywikipedia/core/pywikibot/site.py", line 1297, in callee
    return fn(self, *args, **kwargs)
  File "/shared/pywikipedia/core/pywikibot/site.py", line 4745, in editpage
    result = req.submit()
  File "/shared/pywikipedia/core/pywikibot/data/api.py", line 2178, in submit
    raise APIError(**result['error'])
pywikibot.data.api.APIError: protectednamespace-interface: You're not allowed to edit interface messages [help:See https://pl.wiktionary.org/w/api.php for API usage]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "addLang.py", line 194, in <module>
    main()
  File "addLang.py", line 175, in main
    page10.save(summary='Dodanie języka {0}'.format(zjezyka), as_group='sysop')
  File "/shared/pywikipedia/core/pywikibot/tools/__init__.py", line 1327, in wrapper
    return obj(*__args, **__kw)
  File "/shared/pywikipedia/core/pywikibot/page.py", line 1114, in save
    cc=apply_cosmetic_changes, **kwargs)
  File "/shared/pywikipedia/core/pywikibot/page.py", line 1140, in _save
    raise pywikibot.OtherPageSaveError(self, err)
pywikibot.exceptions.OtherPageSaveError: Edit to page [[MediaWiki:Gadget-langdata.js]] failed:
protectednamespace-interface: You're not allowed to edit interface messages [help:See https://pl.wiktionary.org/w/api.php for API usage]
<class 'pywikibot.exceptions.OtherPageSaveError'>
CRITICAL: Closing network session.

It works fine on my local machine on pywikibot-core.

Event Timeline

Alkamid created this task.Nov 22 2015, 7:01 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.
Masti added a subscriber: Masti.Mar 7 2017, 8:59 PM

using BotPasswords also does not help.

Lokal_Profil added a comment.EditedJan 15 2018, 1:49 PM

I'm encountering a similar problem trying to edit pages on https://se.wikimedia.org using the replace.py script.

The bot account has the right to edit these pages ( I can do it in the browser if I log in), the grants in BotPassword are set up to allow editing protected pages (and other type of edits). But when I try to edit a page in the "Projekt" namespace I get "WARNING: API error protectednamespace: You do not have permission to edit pages in the Projekt namespace."

I get this whether I log in as sysop or not (sysop not actually needed to edit these pages, only the editallpages right) so I'm thinking the issue may be deeper.

Now filled as T184981

Change 531589 had a related patch set uploaded (by Huji; owner: Huji):
[pywikibot/core@master] Check a user's rights before checking its group memberships

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

Change 531589 merged by jenkins-bot:
[pywikibot/core@master] Check a user's rights before checking its group memberships

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

Huji closed this task as Resolved.Aug 26 2019, 5:21 PM
Huji claimed this task.
Huji added a subscriber: Huji.

I am assuming r531589 fixed this. Reopen if otherwise.