Page MenuHomePhabricator

"pairsfile" do not change the text
Closed, ResolvedPublic

Assigned To
Authored By
Vzhik227
Oct 30 2024, 8:00 PM
Referenced Files
F57662937: screen-9.5.0.xt
Oct 31 2024, 9:51 AM
F57662938: screen-7.7.0.xt
Oct 31 2024, 9:51 AM
F57662926: dragonsdogma_family.py
Oct 31 2024, 9:46 AM
F57662913: allwords.txt
Oct 31 2024, 9:43 AM
F57660678: blah.txt
Oct 30 2024, 8:24 PM
F57660675: allwords.txt
Oct 30 2024, 8:24 PM
F57660587: screen-9.5.0.png
Oct 30 2024, 8:00 PM
F57660585: screen-7.7.0.png
Oct 30 2024, 8:00 PM

Description

On Pywikibot version 7.7.0 everything works and there are no spaces. The problem is on versions 8+ and 9+.
I give the command python pwb.py replace -file:blah.txt -pairsfile:allwords.txt
it only changes the text in the wiki article where there are line breaks. (enter). That is, if in the article "a" and "b" are in a line, it will not change to "c" and "d", but if in the column
"a"
"b"
it will change.
The same computer, it is the same version of Python. Only different Pywikibot. 7.7.0 and 9.5.0.

log and screen


screen-7.7.0.png (1×1 px, 94 KB)

screen-9.5.0.png (1×1 px, 73 KB)

Event Timeline

I don't know if you need the file with the words{F57660675}

replacement. I'll attach it if you need it.

Xqt changed the task status from Open to In Progress.Oct 31 2024, 9:11 AM
Xqt claimed this task.
Xqt triaged this task as High priority.

I don't know if you need the file with the words{F57660675}

replacement. I'll attach it if you need it.

the allwords file would help.

Sorry, probably sent badly. Once again:

Thank you. Could you also publish the family file please.

Just in case, the screen is on 7.7.0 and 9.5.0

The regression was introduced with rPWBC11d5f92 in release 8.0.0 where splitlines() was replaced by readlines(). The later keeps the line feed \n for each tag of a line.

Do I need to somehow remake the file allwords.txt?

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

[pywikibot/core@master] [bugfix] strip newlines from pairsfile lines

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

Do I need to somehow remake the file allwords.txt?

No. There is a bug in handling pairsfile which is solved now with the patch above.

Checked the patch. It works! Excellent! Thank you very much!

Change #1085351 merged by Xqt:

[pywikibot/core@master] [bugfix] strip newlines from pairsfile lines

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

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

[pywikibot/core@master] [test] Test replace.handle_pairs()

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

Change #1085374 merged by jenkins-bot:

[pywikibot/core@master] [test] Test replace.handle_pairs()

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