Page MenuHomePhabricator

module 'pywikibot.pagegenerators' has no attribute 'WikidataSPARQLPageGenerator'
Closed, DuplicatePublic


When running this short script:

import pywikibot as pwb
from pywikibot import pagegenerators as pg

QUERY = "SELECT ?item ?value WHERE {?item wdt:P1440 ?value .}"
site = pwb.Site("wikidata", "wikidata")
repo = site.data_repository()
generator = pg.WikidataSPARQLPageGenerator(QUERY,site=site)

for item in generator:

I get this error:

File "Stuff/", line 7, in <module>
    generator = pg.WikidataSPARQLPageGenerator(QUERY,site=site)
AttributeError: module 'pywikibot.pagegenerators' has no attribute 'WikidataSPARQLPageGenerator'
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
<class 'AttributeError'>

Running on:

pywikibot (2.0rc5) - acquired by pip
Python 3.5.2

Event Timeline

Xqt triaged this task as Lowest priority.Oct 29 2016, 2:43 PM
Xqt added subscribers: jayvdb, Xqt.

2.0 issue

WikidataSPARQLPageGenerator isn't part of the 2.0rc5 branch.
Because the "safe" release 2.0 is a lot behind the master (and I have not glue who ever wants to merge all this stuff), you should use the master branch when you need this generator or the pagegenerators -sparql option.

Ok. Is there a way to get the "safe" release with pip?

@Wesalius: unfortunately not. I am unhappy with this situation but personally I do not support 2.0 anymore. It is just hard to work to keep different branches up-to-date, especially when master branch has so many open commits.

Ok. I dont really understand the situation around 2.0/branches since I am an end user and not a developer.

But still I would like to thank everybody working on pywikibot for all the time they are comitting.