Page MenuHomePhabricator

Pywikibot: replace.py : Example command not working
Closed, ResolvedPublic

Description

I am using the replace.py.

Most of the command work.

I wanted to gather article that have certain text.

So I used the https://www.mediawiki.org/wiki/Manual:Pywikibot/replace.py#Example:_Gathering_articles

replace.py -catr:"Állatfajok" iucnredlist.org b -excepttext:"{{redlist" -save:redlist.txt

I modified the code for my machine

python pwb.py replace -catr:"Állatfajok" iucnredlist.org b -excepttext:"{{redlist" -save:redlist.txt

The exact command gives below error:

ERROR: Incomplete command line pattern replacement pair.

Note:Most of other commands are working fine.

Machine:WIndows 10 Latest
Pythin: 3.8 Latest

Event Timeline

Restricted Application added a project: Pywikibot. · View Herald TranscriptDec 13 2019, 7:25 AM
Restricted Application added subscribers: pywikibot-bugs-list, Liuxinyu970226, Aklapper. · View Herald Transcript
Dvorapa added a subscriber: Dvorapa.EditedDec 13 2019, 8:53 AM

-save is no longer a valid parameter, it's been removed. To collect pages there is a listpages.py script.

So the documentation need to be updated.

Can you please suggest me cli syntax to list all pages having a text string?

My best guess is not working

listpages.py -start:! -searchitem:test -save:test.txt

So the documentation need to be updated.

I've already done that :)

Can you please suggest me cli syntax to list all pages having a text string?

What operating system are you running?

Thank you for updating.

I am using Windows 10

Dvorapa added a comment.EditedDec 13 2019, 11:01 AM

Then standard bash python pwb.py listpages -pagegenerators&filters > test.txt should work for you, or maybe python pwb.py listpages -pagegenerators&filters > test.txt 2>&1 this extension (where -pagegenerators&filters are your generators like -start or -catr or your filters like -excepttext).

Jnanaranjan_sahu closed this task as Resolved.Dec 14 2019, 5:52 AM
Jnanaranjan_sahu claimed this task.

Thank You @Dvorapa for the help.

Dvorapa claimed this task.Dec 15 2019, 8:26 PM

No problem :)