Page MenuHomePhabricator

-mysqlquery option of replace.py is not recognized
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce:
pwb replace -simulate -mysqlquery foo bar -automaticsummary

What happens?:
pagegenerator's -mysqlquery option is used and waits for the sql query to be inputted:
Mysql query string:

if pg option is disabled the script fails:

C:\pwb\GIT\core>pwb replace -simulate -mysqlquery foo bar -automaticsummary
The summary message for the command line replacements will be something like: Bot: Automatisierte Textersetzung  (-foo +bar)
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pwb.py", line 494, in <module>
    main()
  File "C:\pwb\GIT\core\pwb.py", line 478, in main
    if not execute():
  File "C:\pwb\GIT\core\pwb.py", line 462, in execute
    run_python_file(filename, script_args, module)
  File "C:\pwb\GIT\core\pwb.py", line 143, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\replace.py", line 1072, in <module>
    main()
  File ".\scripts\replace.py", line 1041, in main
    whereClause = 'WHERE ({})'.format(' OR '.join(
  File ".\scripts\replace.py", line 1041, in <genexpr>
    whereClause = 'WHERE ({})'.format(' OR '.join(
TypeError: cannot unpack non-iterable Replacement object
CRITICAL: Exiting due to uncaught exception <class 'TypeError'>

What should have happened instead?:
replace.py has it's own -mysqlquery option which should be used instead. If no query string is given with -mysqlquery option the default should be used which is described as:

-mysqlquery       Retrieve information from a local database mirror.
                  If no query specified, bot searches for pages with
                  given replacements.

Software version:
Pywikibot 3.0+

Event Timeline

Xqt triaged this task as High priority.

Change 754076 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Enable default -mysqlquery with replace.py

https://gerrit.wikimedia.org/r/754076

Change 754076 merged by Xqt:

[pywikibot/core@master] [bugfix] Enable default -mysqlquery with replace.py

https://gerrit.wikimedia.org/r/754076

It seems that the commit broke the basic functionality of the replace.py script.

Change 760896 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] Restore \"[bugfix] Enable default -mysqlquery with replace.py\"\"

https://gerrit.wikimedia.org/r/760896

Change 760896 merged by jenkins-bot:

[pywikibot/core@master] Restore \"[bugfix] Enable default -mysqlquery with replace.py\"\"

https://gerrit.wikimedia.org/r/760896