Page MenuHomePhabricator

Can't change text with add_text script on a category
Closed, ResolvedPublic

Description

I run basically the same command that is given in the manual and get an error

python3 pwb.py add_text -always -cat:"Unit dialogue (Age of Empires II)" -text:"{{Fairuse}}" -except:"\{\{([Tt]emplate:|)[Ff]airuse" -up
WARNING: /usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat

Traceback (most recent call last):
  File "pwb.py", line 363, in <module>
    if not main():
  File "pwb.py", line 355, in main
    run_python_file(filename,
  File "pwb.py", line 74, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File "./scripts/add_text.py", line 349, in <module>
    main()
  File "./scripts/add_text.py", line 312, in main
    new_arg = ''.join('-grepnot', sep, value)
TypeError: join() takes exactly one argument (3 given)
CRITICAL: Exiting due to uncaught exception <class 'TypeError'>

pwb version output

Pywikibot: [https] r-pywikibot-core.git (3f38f7b, g14033, 2021/01/14, 17:17:07, stable)
Release version: 5.5.0
requests version: 2.22.0
  cacerts: /etc/ssl/certs/ca-certificates.crt
    certificate test: ok
Python: 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0]
PYWIKIBOT_DIR: Not set
PYWIKIBOT_DIR_PWB:
PYWIKIBOT_NO_USER_CONFIG: Not set
Config base dir: /home/red_khan/pywikibot/core
Usernames for family "ageofempires":
        en: Red Khan Bot

I'm running Ubuntu on Windows Subsystem for Linux

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

But exactly the same command used to work some time ago.

Event Timeline

Xqt triaged this task as High priority.Jan 16 2021, 5:23 PM

Change 656581 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] add_text: str.join() expects an iterable not multiple args

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

This bug was introduced with rPWBC7ba53302. Sorry I've overseen that during review. But you can use -grepnot instead of -except option.

No problem, not something that I use on a big scale anymore. Accidentally stumbled upon it, thought that you might want to know about it.

Another detail - unlike -except option -grepnot doesn't seem to give any output.

JJMC89 assigned this task to Xqt.
JJMC89 edited projects, added Pywikibot-Scripts; removed Patch-For-Review.

Change 656581 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] add_text: str.join() expects an iterable not multiple args

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

Another detail - unlike -except option -grepnot doesn't seem to give any output.

Yes. pagegenerators filters does not print anything.