Page MenuHomePhabricator

textlib.removeDisabledParts "expected string or Unicode" on wikidata
Closed, DeclinedPublic

Description

Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1586/
Reported by: Anonymous user
Created on: 2013-02-23 10:30:20
Subject: wikidata error
Original description:
Some script says they might work with wikidata, but:

E:\Pywikipedia>interwiki.py -cleanup cs:wikipedie:wikidata -repository
Getting 1 page from wikipedia:cs...
\[\[cs:Wikipedie:Wikidata\]\]: \[\[cs:Wikipedie:Wikidata\]\] gives new interwiki \[\[simpl
e:Wikipedia:Wikidata\]\]
\[\[cs:Wikipedie:Wikidata\]\]: \[\[cs:Wikipedie:Wikidata\]\] gives new interwiki \[\[en:Wi
kipedia:Wikidata\]\]
\[\[cs:Wikipedie:Wikidata\]\]: \[\[cs:Wikipedie:Wikidata\]\] gives new interwiki \[\[fr:Wi
kipédia:Wikidata\]\]
\[\[cs:Wikipedie:Wikidata\]\]: \[\[cs:Wikipedie:Wikidata\]\] gives new interwiki \[\[de:Wi
kipedia:Wikidata\]\]
\[\[cs:Wikipedie:Wikidata\]\]: \[\[cs:Wikipedie:Wikidata\]\] gives new interwiki \[\[hu:Wi
kipédia:Wikidata\]\]
\[\[cs:Wikipedie:Wikidata\]\]: \[\[cs:Wikipedie:Wikidata\]\] gives new interwiki \[\[sv:Wi
kipedia:Wikidata\]\]
Getting 1 page from wikipedia:simple...
Getting 1 page from wikidata:wikidata...
Traceback \(most recent call last\):
File "E:\Pywikipedia\pagegenerators.py", line 1222, in \_\_iter\_\_
for loaded\_page in self.preload\(somePages\):
File "E:\Pywikipedia\pagegenerators.py", line 1241, in preload
pywikibot.getall\(site, pagesThisSite\)
File "E:\Pywikipedia\wikipedia.py", line 5289, in getall
\_GetAll\(site, pages, throttle, force\).run\(\)
File "E:\Pywikipedia\wikipedia.py", line 4908, in run
data = self.getData\(\)
File "E:\Pywikipedia\wikipedia.py", line 5078, in getData
pagenames = u'\r\n'.join\(pagenames\)
TypeError: sequence item 0: expected string or Unicode, NoneType found
sequence item 0: expected string or Unicode, NoneType found
Dump cs \(wikipedia\) appended.
Traceback \(most recent call last\):
File "E:\Pywikipedia\interwiki.py", line 2602, in <module>
main\(\)
File "E:\Pywikipedia\interwiki.py", line 2576, in main
bot.run\(\)
File "E:\Pywikipedia\interwiki.py", line 2309, in run
self.queryStep\(\)
File "E:\Pywikipedia\interwiki.py", line 2282, in queryStep
self.oneQuery\(\)
File "E:\Pywikipedia\interwiki.py", line 2278, in oneQuery
subject.batchLoaded\(self\)
File "E:\Pywikipedia\interwiki.py", line 1338, in batchLoaded
\(skip, alternativePage\) = self.disambigMismatch\(page, counter\)
File "E:\Pywikipedia\interwiki.py", line 1122, in disambigMismatch
elif not self.originPage.isDisambig\(\) and page.isDisambig\(\):
File "E:\Pywikipedia\wikipedia.py", line 1563, in isDisambig
self.templates\(\)\)
File "E:\Pywikipedia\wikipedia.py", line 2799, in templates
get\_redirect=get\_redirect\)\]\)\)
File "E:\Pywikipedia\wikipedia.py", line 2818, in templatesWithParams
thistxt = removeDisabledParts\(thistxt\)
File "E:\Pywikipedia\pywikibot\textlib.py", line 225, in removeDisabledParts
return toRemoveR.sub\('', text\)
TypeError: expected string or buffer

E:\Pywikipedia>version.py
Pywikipedia trunk/pywikipedia/ \(r11103, 2013/02/22, 16:14:56, ok\)
Python 2.7.2 \(default, Jun 12 2011, 15:08:59\) \[MSC v.1500 32 bit \(Intel\)\]
config-settings:
use\_api = True
use\_api\_login = True
unicode test: ok


Version: compat-(1.0)
Severity: minor
See Also:
https://sourceforge.net/p/pywikipediabot/bugs/1586
https://bugzilla.wikimedia.org/show_bug.cgi?id=69664

Details

Reference
bz55150

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:23 AM
bzimport set Reference to bz55150.
bzimport added a subscriber: Unknown Object (????).

fwiw, this problem also occurs in core version, and it hasnt been resolved in core. The solution to core issue T71664 was to avoid the problem (not fix it) by not calling templates/templatesWithParams, which is definitely not sensible for a wikibase page.

jayvdb set Security to None.
jayvdb removed a subscriber: Unknown Object (????).
Aklapper lowered the priority of this task from Medium to Lowest.Jun 5 2015, 1:41 PM
Aklapper subscribed.

Pywikibot has two versions: Compat and Core. This task was filed about the older version, called Pywikibot-compat, which is not under active development anymore. Hence I'm lowering the priority of this task to reflect the reality. Unfortunately, the Pywikibot team does not have the manpower to retest every single bug report / feature request against the (maintained) Pywikibot code base. Furthermore, the code base of Pywikibot-Compat has changed a lot compared to the code base of Pywikibot-Core so there is a chance that the problem described in this task might not exist anymore. Please help: Unfortunately manpower is limited and does not allow testing every single reported task again. If you have time and interest in Pywikibot, please upgrade to Pywikibot-Core and add a comment to this task if the problem in this task still happens in Pywikibot-Core (or directly edit the task by removing the Pywikibot-compat project and adding the Pywikibot project to this task). To learn more about Pywikibot and to get involved in its development, please check out https://www.mediawiki.org/wiki/Manual:Pywikibot/Development Thank you for your understanding.

Using Wikibase on compat is very discouraged.