[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Xqt
Xqt added a comment. In T364689#9817154 , @Aram wrote: > @Xqt, I don't know how you found out I was using PS ... The preleading PS gave me that hint {icon smile-o spin} **`PS`**`C:\Pywikibot> ...` TASK DETAIL

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Aram
Aram added a comment. @Xqt, I don't know how you found out I was using PS, but I must say you're really smart. Now, I got what you got using `""` in `cmd` and escaping using backtick `"`" in `PS`. And thanks for suggesting //template// script, but I was just wanted to use

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Xqt
Xqt added a comment. Using empty strings with PS --- Try the follwing example invoking the Python command shell. With cmd you can use en empty string like `pwb shell foo "" bar -noimport` For PS you have to escape the empty string in this form using

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Xqt
Xqt added a comment. @Aram: I see, you are using Powershell to invoke the python command. I was able to reproduce the reported behavior with Powershell and it seems that PS ignores empty strings. Please use the `cmd` comand propt and it will work as expected. TASK DETAIL

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Xqt
Xqt added a comment. OK, another try: `pwb shell foo "" bar` The result should be (two comas after foo) `Unknown arguments: foo, , bar` TASK DETAIL https://phabricator.wikimedia.org/T364689 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Xqt

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Aram
Aram added a comment. Without escaping: PS C:\Pywikibot> python pwb.py -simulate replace -page:ئانیشک -site:wiktionary:ckb -regex "{{wikipedia}}\n?" "" -summary:"Replace test" ERROR: Incomplete command line pattern replacement pair: ['{{wikipedia}}\\n?'] command.log:

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Xqt
Xqt added a comment. What is the behaviour and the log with Python 3.12 without escaping? TASK DETAIL https://phabricator.wikimedia.org/T364689 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Xqt Cc: binbot, Xqt, Aklapper, pywikibot-bugs-list,

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Aram
Aram added a comment. @Xqt, I have updated python to the latest version `3.12.3` and tried `-3.12-64` and `-3.10-64` launchers. Both launchers were the same. This is escaping one: PS C:\Pywikibot> python pwb.py -simulate replace -page:ئانیشک -site:wiktionary:ckb -regex

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Xqt
Xqt added a comment. Just an idea to circumvent this sys.argv problem is to use a preleading linespace but does not work if the template is in the first line on the page: python pwb.py -simulate replace -page:ئانیشک -site:wiktionary:ckb -regex "\r?\n{{wikipedia}}\n?" "\n"

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-21 Thread Xqt
Xqt added a comment. Does an escaping work: `python pwb.py -simulate replace -page:ئانیشک -site:wiktionary:ckb -regex "{{wikipedia}}\n?" \"\" -summary:"Replace test"` Are you able to install another python like Python 3.11 or 3.12? You may run different versions using the `py`

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-20 Thread Aram
Aram added a comment. Edition: Windows 10 Pro Version: 1909 OS Build: 18363.900 TASK DETAIL https://phabricator.wikimedia.org/T364689 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Aram Cc: Xqt, Aklapper, pywikibot-bugs-list, Aram, mevo,

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-20 Thread Xqt
Xqt added a comment. Really strange, the empty string is lost in sys.args. What is your Windows version? TASK DETAIL https://phabricator.wikimedia.org/T364689 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Xqt Cc: Xqt, Aklapper,

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-20 Thread Aram
Aram added a comment. @Xqt, Sure, I just updated to the latest version: PS C:\Pywikibot> python pwb.py version Pywikibot: [https] r-pywikibot-core.git (385e9d7, g18846, 2024/05/20, 15:05:27, stable) Release version: 9.1.2 packaging version: 24.0 mwparserfromhell

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-20 Thread Xqt
Xqt added a comment. @Aram: could you please run `pwb version` to get your version information. Are you able to adopt this patch? The replacement pairs should be printed then. TASK DETAIL

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-20 Thread Aram
Aram added a comment. The same thing: python pwb.py -simulate replace -page:ئانیشک -site:wiktionary:ckb -regex "{{wikipedia}}\n?" "" -summary:"Replace test" ERROR: Incomplete command line pattern replacement pair. TASK DETAIL https://phabricator.wikimedia.org/T364689 EMAIL

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-20 Thread Xqt
Xqt added a comment. @Aram: please run the following command for tests: `pwb.py -simulate replace -page:ئانیشک -site:wiktionary:ckb -regex "{{wikipedia}}\n?" "" -summary:"Replace test"` You should get the following: Retrieving 1 pages from wiktionary:ckb. >>>

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-12 Thread gerritbot
gerritbot added a comment. Change #1030595 **merged** by jenkins-bot: [pywikibot/core@master] [IMPR] Show the replacements pairs if they are incomplete as user hint https://gerrit.wikimedia.org/r/1030595 TASK DETAIL https://phabricator.wikimedia.org/T364689 EMAIL PREFERENCES

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-12 Thread gerritbot
gerritbot added a comment. Change #1030595 had a related patch set uploaded (by Xqt; author: Xqt): [pywikibot/core@master] [IMPR] Show the replacements pairs if they are incomplete as user hint https://gerrit.wikimedia.org/r/1030595 TASK DETAIL

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-12 Thread Xqt
Xqt added a comment. > I just noticed that replace.py script of pywikibot can't replace your pattern with null. No it works with empty pattern like this but I guess there is somethin wrong with the generator. For example tr the following command pwb -simulate replace

[Pywikipedia-bugs] [Maniphest] [Commented On] T364689: In pywikibot, replace.py script using -regex can't handle null replacements

2024-05-12 Thread Aram
Aram added a comment. To avoid wasting your time, there is an alternative. python pwb.py replace -family:wiktionary -lang:ckb -file:"countries.txt" -regex "{{wikipedia}}\n?" "{{subst:void}}" -summary:"بۆت: - {{wikipedia}}؛ بە شێوەیەکی خۆگەڕانە لەلایەن {{auto cat}} بەرھەم دێت" I