Last modified: 2014-09-09 02:23:30 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57689, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55689 - Replace.py errors
Replace.py errors
Status: REOPENED
Product: Pywikibot
Classification: Unclassified
Other scripts (Other open bugs)
core-(2.0)
All All
: Low enhancement
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-14 05:58 UTC by Arjuna Rao Chavala
Modified: 2014-09-09 02:23 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Arjuna Rao Chavala 2013-10-14 05:58:08 UTC
Trying to save using -search or -filelinks is giving error (extract below)

arjun@arjun-945GCM-S2L:~/pwb/core$ python pwb.py replace.py  -filelinks:CNREDDY.JPG  -save:cnrtoc.txt "అ" "ఇ"
Traceback (most recent call last):
  File "pwb.py", line 104, in <module>
    run_python_file(fn, args)
  File "pwb.py", line 49, in run_python_file
    exec compile(source, filename, "exec") in main_mod.__dict__
  File "scripts/replace.py", line 696, in <module>
    main()
  File "scripts/replace.py", line 549, in main
    raise pywikibot.Error, 'require even number of replacements.'
pywikibot.exceptions.Error: require even number of replacements.

It is working with  just the first search string. Looks like the documentation (link below) is outof date.

https://www.mediawiki.org/wiki/Manual:Pywikibot/replace.py#Example: Gathering articles
Comment 1 Arjuna Rao Chavala 2013-10-14 06:18:15 UTC
Search argument behavior is not as per expectations

$python pwb.py replace.py  -search:CNREDDY.JPG  -save:cnrtoc.txt "అ" "ఇ"
Traceback (most recent call last):
  File "pwb.py", line 104, in <module>
    run_python_file(fn, args)
  File "pwb.py", line 49, in run_python_file
    exec compile(source, filename, "exec") in main_mod.__dict__
  File "scripts/replace.py", line 696, in <module>
    main()
  File "scripts/replace.py", line 549, in main
    raise pywikibot.Error, 'require even number of replacements.'
pywikibot.exceptions.Error: require even number of replacements.
Comment 2 xqt 2013-10-14 13:08:51 UTC
Neighter -search nor -save are valid option for replace.py on core. Please refer the documentation of the code by pwb.py replace -help
Comment 3 xqt 2013-10-14 13:12:16 UTC
Sorry, -search option is quite right but -save option is available on compat version only (yet).
Comment 4 xqt 2013-10-14 13:14:07 UTC
Reopened as feature request

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links