RPI2026F1 created this task.
RPI2026F1 added projects: Pywikibot, Pywikibot-Wikidata.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
**Steps to replicate the issue** (include links if applicable):
import pywikibot
site = pywikibot.Site("wikidata", "wikidata")
item = pywikibot.ItemPage(site, "Q4115189")
item.editEntity()
**What happens?**:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File /srv/paws/pwb/pywikibot/site/_basesite.py:192, in
BaseSite.__getattr__(self, attr)
191 try:
--> 192 method = getattr(self.family, attr)
193 if not callable(method):
AttributeError: 'Family' object has no attribute '_namespaces'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
File /srv/paws/pwb/pywikibot/tools/__init__.py:748, in
cached.<locals>.wrapper(obj, force)
747 try:
--> 748 return getattr(obj, cache_name)
749 except AttributeError:
File /srv/paws/pwb/pywikibot/site/_basesite.py:200, in
BaseSite.__getattr__(self, attr)
199 except AttributeError:
--> 200 raise AttributeError("{} instance has no attribute '{}'"
201 .format(self.__class__.__name__, attr))
AttributeError: APISite instance has no attribute '_namespaces'
During handling of the above exception, another exception occurred:
NoUsernameError Traceback (most recent call last)
File /srv/paws/pwb/pywikibot/page/_decorators.py:34, in
_allow_asynchronous.<locals>.handle(func, self, *args, **kwargs)
33 try:
---> 34 func(self, *args, **kwargs)
35 # TODO: other "expected" error types to catch?
File /srv/paws/pwb/pywikibot/page/_wikibase.py:647, in
WikibasePage.editEntity(self, data, **kwargs)
646 # kept for the decorator which provides the keyword arguments
--> 647 super().editEntity(data, **kwargs)
File /srv/paws/pwb/pywikibot/page/_wikibase.py:299, in
WikibaseEntity.editEntity(self, data, **kwargs)
298 if data is None:
--> 299 data = self.toJSON(diffto=getattr(self, '_content', None))
300 else:
File /srv/paws/pwb/pywikibot/page/_wikibase.py:193, in
WikibaseEntity.toJSON(self, diffto)
192 else:
--> 193 value = attr.toJSON()
194 if value:
File /srv/paws/pwb/pywikibot/page/_collections.py:459, in
SiteLinkCollection.toJSON(self, diffto)
451 """
452 Create JSON suitable for Wikibase API.
453
(...)
457 :param diffto: JSON containing entity data
458 """
--> 459 data = {dbname: sitelink.toJSON()
460 for (dbname, sitelink) in self.items()}
461 if diffto:
File /srv/paws/pwb/pywikibot/page/_collections.py:459, in <dictcomp>(.0)
451 """
452 Create JSON suitable for Wikibase API.
453
(...)
457 :param diffto: JSON containing entity data
458 """
--> 459 data = {dbname: sitelink.toJSON()
460 for (dbname, sitelink) in self.items()}
461 if diffto:
File /usr/lib/python3.10/_collections_abc.py:906, in
ItemsView.__iter__(self)
905 for key in self._mapping:
--> 906 yield (key, self._mapping[key])
File /srv/paws/pwb/pywikibot/page/_collections.py:366, in
SiteLinkCollection.__getitem__(self, key)
365 elif isinstance(val, dict):
--> 366 val = pywikibot.page.SiteLink.fromJSON(val, self.repo)
367 else:
File /srv/paws/pwb/pywikibot/page/_links.py:752, in SiteLink.fromJSON(cls,
data, site)
743 """
744 Create a SiteLink object from JSON returned in the API call.
745
(...)
750 :rtype: pywikibot.page.SiteLink
751 """
--> 752 sl = cls(data['title'], data['site'])
753 repo = site or sl.site.data_repository()
File /srv/paws/pwb/pywikibot/page/_links.py:697, in SiteLink.__init__(self,
title, site, badges)
696 if ':' in title:
--> 697 site, namespace, title = SiteLink._parse_namespace(title, site)
699 super().__init__(title, namespace, site)
File /srv/paws/pwb/pywikibot/page/_links.py:724, in
SiteLink._parse_namespace(title, site)
723 prefix = title[:title.index(':')].lower() # part of text before :
--> 724 ns = site.namespaces.lookup_name(prefix)
725 if ns: # The prefix is a namespace in the source wiki
File /srv/paws/pwb/pywikibot/tools/__init__.py:750, in
cached.<locals>.wrapper(obj, force)
749 except AttributeError:
--> 750 val = fn(obj)
751 setattr(obj, cache_name, val)
File /srv/paws/pwb/pywikibot/site/_basesite.py:246, in
BaseSite.namespaces(self)
245 """Return dict of valid namespaces on this wiki."""
--> 246 return NamespacesDict(self._build_namespaces())
File /srv/paws/pwb/pywikibot/site/_apisite.py:1020, in
APISite._build_namespaces(self)
1018 _namespaces = {}
-> 1020 for nsdata in self.siteinfo.get('namespaces', cache=False).values():
1021 ns = nsdata.pop('id')
File /srv/paws/pwb/pywikibot/site/_siteinfo.py:304, in Siteinfo.get(self,
key, get_default, cache, expiry)
302 return copy.deepcopy(cached[0])
--> 304 preloaded = self._get_general(key, expiry)
305 if not preloaded:
File /srv/paws/pwb/pywikibot/site/_siteinfo.py:242, in
Siteinfo._get_general(self, key, expiry)
241 props += ['general']
--> 242 default_info = self._get_siteinfo(props, expiry)
243 for prop in props:
File /srv/paws/pwb/pywikibot/site/_siteinfo.py:167, in
Siteinfo._get_siteinfo(self, prop, expiry)
166 try:
--> 167 data = request.submit()
168 except APIError as e:
File /srv/paws/pwb/pywikibot/data/api/_requests.py:1258, in
CachedRequest.submit(self)
1257 if not cached_available:
-> 1258 self._data = super().submit()
1259 self._write_cache(self._data)
File /srv/paws/pwb/pywikibot/data/api/_requests.py:1075, in
Request.submit(self)
1074 continue
-> 1075 raise NoUsernameError('Failed OAuth authentication for {}: {}'
1076 .format(self.site, info))
1077 if code == 'cirrussearch-too-busy-error': # T170647
NoUsernameError: Failed OAuth authentication for wikipedia:fi: The
authorization headers in your request are for a user that does not exist here
During handling of the above exception, another exception occurred:
OtherPageSaveError Traceback (most recent call last)
Cell In[2], line 1
----> 1 item.editEntity()
File /srv/paws/pwb/pywikibot/page/_decorators.py:55, in
_allow_asynchronous.<locals>.wrapper(self, *args, **kwargs)
53 pywikibot.async_request(handle, func, self, *args, **kwargs)
54 else:
---> 55 handle(func, self, *args, **kwargs)
File /srv/paws/pwb/pywikibot/page/_decorators.py:47, in
_allow_asynchronous.<locals>.handle(func, self, *args, **kwargs)
45 if isinstance(err, PageSaveRelatedError):
46 raise err
---> 47 raise OtherPageSaveError(self, err)
48 if callback:
49 callback(self, err)
OtherPageSaveError: Edit to page [[wikidata:Q4115189]] failed:
Failed OAuth authentication for wikipedia:fi: The authorization headers in
your request are for a user that does not exist here
**What should have happened instead?**: The edit should do nothing since
nothing changed
**Software version** (skip for WMF-hosted wikis like Wikipedia):
**Other information** (browser name/version, screenshots, etc.):
TASK DETAIL
https://phabricator.wikimedia.org/T325915
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: RPI2026F1
Cc: Aklapper, pywikibot-bugs-list, RPI2026F1, PotsdamLamb, Jyoo1011,
JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS,
Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, Xqt, jayvdb,
Ricordisamoa, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]