Sovmogil added a comment.

Hi!
I am sorry, but
with this version:

Pywikibot: pywikibot/__init__.py (c4ccfae, -1 (unknown), 2017/05/05, 01:02:04, n/a)
Release version: 2.0rc5
httplib2 version: 0.9.1
  cacerts: D:\SNMs\refinery\pywikibot\core_stable\externals\httplib2\python3\httplib2\cacerts.txt
    certificate test: ok
Python: 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
  unicode test: ok
PYWIKIBOT2_DIR: Not set
PYWIKIBOT2_DIR_PWB:
PYWIKIBOT2_NO_USER_CONFIG: Not set
Config base dir: D:\SNMs\refinery\pywikibot\core_stable
Usernames for family "wikipedia":
        ru: Sovmogil (no sysop configured)

and with this script --

import pywikibot

from pywikibot import pagegenerators as pg

def list_template_usage(site_obj, tmpl_name):
    """
    Takes Site object and template name and returns a generator.

    The function expects a Site object (pywikibot.Site()) and
    a template name (String). It creates a list of all
    pages using that template and returns them as a generator.
    The generator will load 50 pages at a time for iteration.
    """
    name = "{}:{}".format(site_obj.namespace(10), tmpl_name)
    tmpl_page = pywikibot.Page(site_obj, name)
    ref_gen = pg.ReferringPageGenerator(tmpl_page, _onlyTemplateInclusion_=True)
    filter_gen = pg.NamespaceFilterPageGenerator(ref_gen, namespaces=[0])
    generator = site_obj.preloadpages(filter_gen, groupsize=20, templates=False, langlinks=False)
    return generator

site = pywikibot.Site("ru", 'wikipedia')
tmpl_gen = list_template_usage(site, "geo-stub")

for page in tmpl_gen:
    item = pywikibot.ItemPage.fromPage(page)
    print(item.getID())

I am stil getting this error --

D:\SNMs\refinery\pywikibot\core_stable>python testpull02.py
Retrieving 20 pages from wikipedia:ru.
Q5214867
Q4163312
Q4289585
Traceback (most recent call last):
  File "testpull02.py", line 25, in <module>
    item = pywikibot.ItemPage.fromPage(page)
  File "D:\SNMs\refinery\pywikibot\core_stable\pywikibot\page.py", line 3556, in fromPage
    if not lazy_load and not i.exists():
  File "D:\SNMs\refinery\pywikibot\core_stable\pywikibot\page.py", line 3158, in exists
    self.get()
  File "D:\SNMs\refinery\pywikibot\core_stable\pywikibot\page.py", line 3576, in get
    c = Claim.fromJSON(self.repo, claim)
  File "D:\SNMs\refinery\pywikibot\core_stable\pywikibot\page.py", line 3995, in fromJSON
    claim.type, lambda value, site: value)(value, site)
  File "D:\SNMs\refinery\pywikibot\core_stable\pywikibot\page.py", line 3942, in <lambda>
    'quantity': lambda value, site: pywikibot.WbQuantity.fromWikibase(value),
  File "D:\SNMs\refinery\pywikibot\core_stable\pywikibot\__init__.py", line 512, in fromWikibase
    upperBound = eval(wb['upperBound'])
KeyError: 'upperBound'

I've read it was kind of fixed, but it seems to be not... Any suggestions how it is to be better handled please.

Thank you for your time


TASK DETAIL
https://phabricator.wikimedia.org/T150210

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lokal_Profil, Sovmogil
Cc: Sovmogil, Mike_Peel, Holger, daniel, Magul, ChongDae, Strainu, gerritbot, Aklapper, Lokal_Profil, pywikibot-bugs-list, Adik2382, Th3d3v1ls, Ramalepe, Liugev6, Tbscho, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, Avicennasis, Sn1per, jayvdb, Ricordisamoa, Dalba, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to