Page MenuHomePhabricator

newitem.py fails: TypeError: string indices must be integers
Closed, ResolvedPublic

Description

After svn update of pywikibot i tried

I:\PWB2>pwb.py newitem -family:wikisource -start:category:Du -pageage:0 -lastedit:0  -lang:cs
WARNING: .\scripts\newitem.py:59: DeprecationWarning: pywikibot.site.APISite.getcurrenttime is deprecated for 5 years and 4 months; use pywikibot.site.APISite.server_time instead.
  self.pageAgeBefore = self.repo.getcurrenttime() - timedelta(

WARNING: .\scripts\newitem.py:61: DeprecationWarning: pywikibot.site.APISite.getcurrenttime is deprecated for 5 years and 4 months; use pywikibot.site.APISite.server_time instead.
  self.lastEditBefore = self.repo.getcurrenttime() - timedelta(

Page age is set to 0 days so only pages created
before 2020-04-30T11:47:39Z will be considered.
Last edit is set to 0 days so only pages last edited
before 2020-04-30T11:47:39Z will be considered.
WARNING: NewItemRobot.__init__ set the Bot.site property; this is only needed when the Bot accesses many sites.
Retrieving 50 pages from wikisource:cs.


>>> Kategorie:Duchoslav Panýrek <<<
[[cs:Kategorie:Duchoslav Panýrek]] already has an item: [[wikidata:Q17121249]].

...
>>> Kategorie:Dušan Dudík <<<
Creating item for [[cs:Kategorie:Dušan Dudík]]...
Change summary: Bot: New item with sitelink from [[wikisource:cs:Kategorie:Dušan Dudík]]
Exception in thread Put-Thread:
Traceback (most recent call last):


>>>   File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
Kategorie:Dánové v Ottově slovníku naučném    self.run()
  File "C:\Python38\lib\threading.py", line 870, in run
 <<<
    self._target(*self._args, **self._kwargs)
  File "I:\PWB2\pywikibot\__init__.py", line 1406, in async_manager
    request(*args, **kwargs)
  File "I:\PWB2\pywikibot\page\__init__.py", line 115, in handle
    func(self, *args, **kwargs)
  File "I:\PWB2\pywikibot\page\__init__.py", line 4522, in editEntity
    super(WikibasePage, self).editEntity(
  File "I:\PWB2\pywikibot\page\__init__.py", line 4238, in editEntity
    data = self._normalizeData(data)
  File "I:\PWB2\pywikibot\page\__init__.py", line 4177, in _normalizeData
    norm_data[key] = attr.normalizeData(data[key])
  File "I:\PWB2\pywikibot\page\__init__.py", line 3986, in normalizeData
    db_name = obj['site']
TypeError: string indices must be integers
[[cs:Kategorie:Dánové v Ottově slovníku naučném]] already has an item: [[wikidata:Q17516787]].

The same error when I use actual bot from https://tools.wmflabs.org/pywikibot/

Event Timeline

I got another exception for the same command:

Moved to T251520

Xqt triaged this task as High priority.Apr 30 2020, 12:32 PM

I got another exception for the same command:

Maybe this is a known wikidata issue which stucks and gives wrong results

Looks like SiteLinkCollection.normalizeData should accept all of: list of pywikibot.Page's, list of dicts {'site': '...', 'title': '...'}, dbname/pywikibot.Site-indexed dict of dicts {'site': '...', 'title': '...'}, dbname/pywikibot.Site-indexed dict of pywikibot.Page's or strings...

I got another exception for the same command:

Maybe this is a known wikidata issue which stucks and gives wrong results

I can see a trace of maxlag there, so definitely could be.

Change 593729 had a related patch set uploaded (by Matěj Suchánek; owner: Matěj Suchánek):
[pywikibot/core@master] [IMPR] Unify and extend formats for setting sitelinks

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

Change 593729 merged by jenkins-bot:
[pywikibot/core@master] [IMPR] Unify and extend formats for setting sitelinks

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

Xqt assigned this task to matej_suchanek.