So while writing some methods for Wikidata, I discovered that locked wikis, deleted wikis, and renamed wikis all go into the same family.obsolete dict. In fact, its impossible to create a site object for a closed wiki (both in trunk and rewrite):
wikipedia.getSite('aa','wikipedia')
pywikibot.exceptions.NoSuchSite: Language aa in family wikipedia is obsolete
This isn't favorable behavior since it prevents read access as well, and write access for those who have it (stewards).
I wrote a quick patch for rewrite which separated this into three different groups: locked (readable but not writable), deleted (not readable), and "obsolete" (renamed wikis and backwards compatibility). Trying to create a site for a locked wiki works fine, but will throw an error when you try to fetch an edit token. Creating a site for a deleted or obsolete wiki will throw the same error as before, just with a little bit more specific error message.
What do people think? This is a bit urgent since Wikidata support in trunk is broken because of it:
wikipedia.DataPage(wikipedia.getSite('en','wikipedia'), 'Main
Page').interwiki() pywikibot.exceptions.NoSuchSite: Language ii in family wikipedia is obsolete
-- Legoktm
Today I was trying to switch some code of mine from old fashion interwiki to wikidata based. I found http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Wikidata#Getting_data page and based on that I wrote:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import wikipedia as pywikibot
if __name__ == "__main__":
try:
site = pywikibot.getSite(u'it', u'wikipedia')
page = pywikibot.Page(site, 'Fabio degli Abati Olivieri')
data = pywikibot.DataPage(page)
language_links = data.interwiki()
for page in language_links:
print page.title(asLink=True)
finally:
pywikibot.stopme()
The output was:
[[commons:fr:Fabio Olivieri]]
[[commons:de:Fabio Olivieri]]
[[commons:it:Fabio degli Abati Olivieri]]
Which seem to point to non existing language specific Commons sites instead of Wikipedias. I worked around this issue, but what is the source of this issue: Wikidata, Italian Wikipedia, pywikipediabot?
Jarek T.
User:jarekt
This is really a bug in the current implementation of Page.title(). I guess you have family = 'commons' in your user-config.py If you change it to 'wikipedia' (as a work-around) it will work as expected. But this must be fixed.
Greetings xqt
----- Original Nachricht ---- Von: "Tuszynski, Jaroslaw W." JAROSLAW.W.TUSZYNSKI@saic.com An: Pywikipedia discussion list pywikipedia-l@lists.wikimedia.org Datum: 04.03.2013 18:34 Betreff: [Pywikipedia-l] interlanguage links from Wikidata
Today I was trying to switch some code of mine from old fashion interwiki to wikidata based. I found http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Wikidata#Getting_data page and based on that I wrote:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import wikipedia as pywikibot
if __name__ == "__main__":
try: site = pywikibot.getSite(u'it', u'wikipedia') page = pywikibot.Page(site, 'Fabio degli Abati Olivieri') data = pywikibot.DataPage(page) language_links = data.interwiki() for page in language_links: print page.title(asLink=True) finally: pywikibot.stopme()
The output was:
[[commons:fr:Fabio Olivieri]]
[[commons:de:Fabio Olivieri]]
[[commons:it:Fabio degli Abati Olivieri]]
Which seem to point to non existing language specific Commons sites instead of Wikipedias. I worked around this issue, but what is the source of this issue: Wikidata, Italian Wikipedia, pywikipediabot?
Jarek T.
User:jarekt
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
fixed in r11181 I tested it and it was ok but test it again and inform me :)
Best
On Wed, Mar 6, 2013 at 10:54 AM, info@gno.de wrote:
This is really a bug in the current implementation of Page.title(). I guess you have family = 'commons' in your user-config.py If you change it to 'wikipedia' (as a work-around) it will work as expected. But this must be fixed.
Greetings xqt
----- Original Nachricht ---- Von: "Tuszynski, Jaroslaw W." JAROSLAW.W.TUSZYNSKI@saic.com An: Pywikipedia discussion list pywikipedia-l@lists.wikimedia.org Datum: 04.03.2013 18:34 Betreff: [Pywikipedia-l] interlanguage links from Wikidata
Today I was trying to switch some code of mine from old fashion
interwiki to
wikidata based. I found
http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Wikidata#Getting_data
page and based on that I wrote:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import wikipedia as pywikibot
if __name__ == "__main__":
try: site = pywikibot.getSite(u'it', u'wikipedia') page = pywikibot.Page(site, 'Fabio degli Abati Olivieri') data = pywikibot.DataPage(page) language_links = data.interwiki() for page in language_links: print page.title(asLink=True) finally: pywikibot.stopme()
The output was:
[[commons:fr:Fabio Olivieri]]
[[commons:de:Fabio Olivieri]]
[[commons:it:Fabio degli Abati Olivieri]]
Which seem to point to non existing language specific Commons sites
instead
of Wikipedias. I worked around this issue, but what is the source of
this
issue: Wikidata, Italian Wikipedia, pywikipediabot?
Jarek T.
User:jarekt
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Yes I do have family = 'commons' in my user-config.py. I had it set like that for few years now, but I never run into this issue until I started using interwikis from wikidata.
Thanks for fixing this.
Jarek T.
User:jarekt
From: pywikipedia-l-bounces@lists.wikimedia.org [mailto:pywikipedia-l-bounces@lists.wikimedia.org] On Behalf Of Amir Ladsgroup Sent: Wednesday, March 06, 2013 3:15 AM To: Pywikipedia discussion list Subject: Re: [Pywikipedia-l] interlanguage links from Wikidata
fixed in r11181
I tested it and it was ok but test it again and inform me :)
Best
On Wed, Mar 6, 2013 at 10:54 AM, info@gno.de wrote:
This is really a bug in the current implementation of Page.title(). I guess you have family = 'commons' in your user-config.py If you change it to 'wikipedia' (as a work-around) it will work as expected. But this must be fixed.
Greetings xqt
----- Original Nachricht ---- Von: "Tuszynski, Jaroslaw W." JAROSLAW.W.TUSZYNSKI@saic.com An: Pywikipedia discussion list pywikipedia-l@lists.wikimedia.org Datum: 04.03.2013 18:34 Betreff: [Pywikipedia-l] interlanguage links from Wikidata
Today I was trying to switch some code of mine from old fashion
interwiki to
wikidata based. I found
http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Wikidata#Getting_dat a
page and based on that I wrote:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import wikipedia as pywikibot
if __name__ == "__main__":
try: site = pywikibot.getSite(u'it', u'wikipedia') page = pywikibot.Page(site, 'Fabio degli Abati Olivieri') data = pywikibot.DataPage(page) language_links = data.interwiki() for page in language_links: print page.title(asLink=True) finally: pywikibot.stopme()
The output was:
[[commons:fr:Fabio Olivieri]]
[[commons:de:Fabio Olivieri]]
[[commons:it:Fabio degli Abati Olivieri]]
Which seem to point to non existing language specific Commons sites
instead
of Wikipedias. I worked around this issue, but what is the source of
this
issue: Wikidata, Italian Wikipedia, pywikipediabot?
Jarek T.
User:jarekt
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
_______________________________________________ Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
pywikipedia-l@lists.wikimedia.org