[Pywikipedia-l] error in replace.py rewrite branch

Russell Blau russblau at imapmail.org
Thu Sep 24 21:39:31 UTC 2009


Matias wrote:

> Hi everyone. When trying to use a version of replace.py I get this error:
>
> Traceback (most recent call last):
>   File "pande_replace.py", line 742, in <module>
>     main()
>   File "pande_replace.py", line 725, in main
>     gen = genFactory.getCombinedGenerator(gen)
> TypeError: getCombinedGenerator() takes exactly 1 argument (2 given)
>
> Line 725 is:
>
>        query = u"""
> SELECT page_namespace, page_title
> FROM page
> JOIN text ON (page_id = old_id)
> %s
> %s
> LIMIT 200""" % (whereClause, exceptClause)
>        gen = pagegenerators.MySQLPageGenerator(query)
>    elif PageTitles:
>        pages = [pywikibot.Page(pywikibot.getSite(), PageTitle)
>                 for PageTitle in PageTitles]
>        gen = iter(pages)
>
>    gen = genFactory.getCombinedGenerator(gen)

You're not using genFactory correctly here; genFactory can only return a 
generator based on the standard command-line arguments, but it looks like 
you are trying to define your own generator from a MySQL query.  Without 
seeing the rest of your program it's hard to tell, but maybe you should just 
eliminate the references to genFactory entirely.

If you do use a generator factory, the correct method call is "gen = 
genFactory.getCombinedGenerator()" without any argument(s).

Russ




More information about the Pywikipedia-l mailing list