Manual talk:Pywikibot/replace.py

The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).
edit

I am trying to replace something in the text, but not if it appears within the links. I am not sure how to do it, as both the old and new forms appear in the links.

diacritics

edit

How can I use with this bot diacritics (UTF-8) ? It is very important for Romanian Wikipedia. --Romihaitza 17:26, 6 February 2006 (UTC)Reply

I've just converted the article names and it's working. JackPotte 01:32, 16 November 2009 (UTC)Reply

Bug

edit

When loading an entry list via -file: parameter, if the wikilinks have accents or any non plain ascii, bot borks and dies before doing makign any changes (even if there are thousands of entries before that one which are plain ascii). For example: Talk:Benjamín Urrutia (on en:) makes the bot break because of the accented i. 132.248.81.29 23:48, 10 March 2006 (UTC)Reply

forgot to sign drini 23:49, 10 March 2006 (UTC)Reply

Problem

edit

It has a problem - if i open replace.py, i get a question "Please enter the text that should be replaced", and when i typing it the text and press enter, i get the second question "Press enter the new text", typing the new text and i press enter and i press enter 2 times again, but the command window disappear immediately. --IL 18:18, 18 March 2006 (UTC)Reply

Sounds like you haven't specified the range of pages to check for the misspelling. When you run "python replace.py", try appending something like "-start:!" or "-start:A". 129.21.121.171 06:11, 18 May 2006 (UTC)Reply
So in other words, without computer jargon. Type:
replace.py -start:A
Odessaukrain 22:33, 24 May 2008 (UTC)Reply

Cat-based replace

edit

Category-based replace seems to be invariably giving no results, Getting 0 pages from .... Is this a bug or am I missing something? I've tried with both the category name itself and with the Category: prefix, as well as with spaces in the name and underscores in the name. Help? --88.113.114.226 16:37, 31 May 2006 (UTC)Reply

Maybe someone did not add the category to the pages but did list the articles there manually, then it might not work. Give the page where you have the problem please, greetings --birdy geimfyglið (:> )=| 19:36, 31 May 2006 (UTC)Reply

I can't seem to get Category-based replace to work either. Here's the command I used that failed:

   python replace.py -cat:Front_groups "{{tobaccowiki}}" "{{#badge: tobaccowiki | front groups}}"

--Sheldon Rampton 04:40, 23 December 2007 (UTC)Reply

I experienced it like you can only work on categories that indeed contain pages. The bot won't run on pages in subcategories. --Plasmarelais 18:14, 30 August 2009 (UTC)Reply

Finding pages

edit

This script seems to have a hard time finding pages. It can get pages from Special:Allpages, even edit articles (with edit_article.py), but whenever I try to replace something, I get a face full of "Page X not found". Any help? The Mu 20:11, 18 August 2006 (UTC)Reply

Someone reported a similar problem with replace.py for non-WMF sites on #pywikipediabot. Not sure what the problem is, as other tools seem to work. --Connel MacKenzie 19:00, 10 September 2006 (UTC)Reply
Yeah, thats me, I have the same problem. The -ref: and -start:! options work all 'fine' but I always get "Getting xx pages from mywiki:en" followed by a number of "Page Foobar not found". Most other scripts work just fine. I work from Windows XP to Mediawiki 1.6.8. I've also just downloaded the september 5 version of the pywikipedia framework. --GrandiJoos 20:57, 10 September 2006 (UTC)Reply
Update: weblinkchecker.py also reports "Article_X does not exist"... --GrandiJoos 08:06, 11 September 2006 (UTC)Reply
Fix: in localsettings add
$wgGroupPermissions['bot'  ]['export']          = true;

Thanks to Andre Engels. --GrandiJoos 11:07, 2 October 2006 (UTC)Reply

Problem with utf-8

edit
 [[한국]]
 [[월드컵]]
 [[미국]]
 [[나비]]
 python replace.py -file:articles_list.txt "errror" "error"
I make a file, and run my bot...
RESULT: error!!
Korean exlorer, wikipedia use utf-8 (unicode)
cmd use not utf-8
and python also use not utf-8
help me~!!
How setting for me? -- WonYong(Talk / Contrib) 11:46, 11 September 2006 (UTC)Reply
I've just converted the article names and it's working. JackPotte 01:30, 16 November 2009 (UTC)Reply

Bot problem (korean language)

edit
  • I have a question.
  • I input 스모그 to interwiki.py in WIN XP's cmd.exe console.
 C:\pywikipedia>interwiki.py -start:스모그 -autonomous
  • following is result...
Checked for running processes. 1 processes currently running, including the current process.
NOTE: Number of pages queued is 0, trying to add 60 more.
Retrieving Allpages special page for wikipedia:ko from %C2%BD%C2%BA%C2%B8%C3%B0%C2%B1%C3%97, namespace 0
Getting 60 pages from wikipedia:ko...
  • and, I input 스모그 to web wikipedia (ko:)
  • thus, connected to link as follows:
 w:ko:스모그
  • Why? is different?
%EC%8A%A4%EB%AA%A8%EA%B7%B8
I input 스모그 to web wikipedia (ko:)
%C2%BD%C2%BA%C2%B8%C3%B0%C2%B1%C3%97
I input 스모그 to cmd console
  • It is a bug??
  • and, I input by file method...
C:\pywikipedia>
C:\pywikipedia>copy con aa.txt
[[스모그]]
^Z
C:\pywikipedia>interwiki.py -file:aa.txt
Checked for running processes. 1 processes currently running, including the current process.
NOTE: Number of pages queued is 0, trying to add 60 more.
Dump ko (wikipedia) saved
Traceback (most recent call last):
File "C:\pywikipedia\interwiki.py", line 1467, in ?
bot.run()
File "C:\pywikipedia\interwiki.py", line 1200, in run
self.queryStep()
File "C:\pywikipedia\interwiki.py", line 1174, in queryStep
self.oneQuery()
File "C:\pywikipedia\interwiki.py", line 1132, in oneQuery
site = self.selectQuerySite()
File "C:\pywikipedia\interwiki.py", line 1114, in selectQuerySite
self.generateMore(globalvar.maxquerysize - mycount)
File "C:\pywikipedia\interwiki.py", line 1050, in generateMore
page = self.pageGenerator.next()
File "C:\pywikipedia\pagegenerators.py", line 162, in __iter__
for pageTitle in R.findall(f.read()):
File "C:\Python24\lib\codecs.py", line 481, in read
return self.reader.read(size)
File "C:\Python24\lib\codecs.py", line 293, in read
newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xbd in position 2: unexpected code byte
C:\pywikipedia>
Acording as korean wiki admin, use it as following:
1.
 C:\pywikipedia>interwiki.py -start:스모그 -autonomous  (X)
 C:\pywikipedia>interwiki.py -start:%EC%8A%A4%EB%AA%A8%EA%B7%B8 -autonomous  (O)
So, I use it.
2. and, edit user-config.py file.
 console-encoding = 'cp949'
3.
 cmd.exe /U
4. cmd font change to truetype korean font
RESULT: cmd Output is good. korean font output is not broken. WOW!!
but, I also want NOT BROKEN INPUT as following:
 C:\pywikipedia>interwiki.py -start:스모그 -autonomous  (O)
help!! -- WonYong(Talk / Contrib) 11:59, 11 September 2006 (UTC)Reply

regex BUG

edit

tried with several version of pywikipedia any change with regular expression leads to a crash can you fix this huge bug? thanks

Bug: "\n" in replacement text

edit

I can't put a newline in the replacement text. For example:

 python replace.py "AbcDef" "Abc\nDef"

actually inserts the literal characters "\n" rather than a newline. — Preceding unsigned comment added by 128.165.16.45 (talkcontribs) 20:46, 9 July 2007

If you are using a bash command line, you can add a literal new line by simply press enter:
$ python replace.py "AbcDef" "Abc
> Def"

Cheers, John Vandenberg 23:16, 27 September 2007 (UTC)Reply

Correct command for interwiki purposes

edit

Suppose that we have a page, say w:Door, with 19 links to it. We decide to tarnswiki it to Wiktionary, and we want all links to w:Door to be directed towards wikt:door. What is the correct command to achieve that, using replace.py? Huji 17:28, 27 August 2007 (UTC)Reply

use xml dump

edit

if I use a xml dump with the option -xml the program must modify not only the online page, but also the xml version, so if I redo the same operation the script finds that the page is already modified. --Wiso 15:36, 27 September 2007 (UTC)Reply

Isredirect and putthrottle

edit

2 issues:

I have tried to edit pages using -ref:, and when I use that, it says "Isredirect". When I don't use that, it works.

I have also tried putting -putthrottle: to 12, and it does it in shorter amounts of time.

why are these happening?

How could I replace the text wich contain two or more lines?

edit

For example I must change the text:

==Subtitle==

with the following:

==Subtitle==
{{template}}

How could I do it? The problem is that I could not press enter while typing the replaceing text and I couldn't use <br> because it will not cause the expected effect --A1 20:04, 3 December 2007 (UTC)Reply

Hi, I would make it like this, modify replace.py the following way:
remove everything between
    elif fix == None:
and
    else:
        # Perform one of the predefined actions.
Then put in between them
        replacements.append((u'\=\=Subtitle\=\=',u'==Subtitle==\r\n{{test}}')) 
        wikipedia.setAction(u'summaryhere')
Name the file other than replace.py (e.g. myreplace.py)
Run with myreplace.py -regex option.
Best regards, --birdy geimfyglið (:> )=| 20:20, 3 December 2007 (UTC)Reply
Thank you but it doesn't work. Am I right:
elif fix == None:
        replacements.append((u'\=\=Subtitle\=\=',u'==Subtitle==\r\n{{test}}')) 
        wikipedia.setAction(u'summaryhere')
    else:
--A1 21:46, 11 December 2007 (UTC)Reply
Worked perfectly for me [1], did You save the modified.py file as UTF-8? Did You run with -regex option? Best regards, --birdy geimfyglið (:> )=| 04:22, 8 February 2008 (UTC)Reply
I think it's easier to use -regex with "==Subtitle==" "==Subtitle==\n{{template}}" --Plasmarelais 16:49, 29 September 2009 (UTC)Reply

And how to do replacing:

{{template}}
==Subtitle==

with the following:

==Subtitle==
{{template}}

? JAn Dudík 21:29, 4 January 2010 (UTC)Reply

It depends: does the subtitles and templates vary? It's much easier if they're always the same. --Plasmarelais 15:52, 18 January 2010 (UTC)Reply

Nothing happens

edit

I need some help with replace.py

I installed Python25 and Pywikipedia on my computer

The purpose : use it on a MediaWiki installation (in french), in version 1.6.7

I configured my user-config.py, my [name_of_the_wiki]_family.py that I put in families directory...

And i launched the /cmd on Windows in order to use Python

I've already created an account for the bot on the Wiki ( its name is Orthobot)

Then I launch python.exe login.py (and there isn't any problem)

Then I launch replace.py like that :

python.exe replace.py -page:Abheva "sanscrit" "sanskrit"

The bot finds the page, finds the word, asks me if I want to replace it...

And it says the page has been replaced.

But the problem is that, when I look at this page, the replacement hasn't been made

So, I don't understand : everything seems to be ok but It doesn't work

Any idea ?

Urobore 22:39, 7 February 2008 (UTC)Reply

Try the following: run replace.py -page:Abheva (without anything else) and type enter the text when prompted.
If You can't get it to work, You will find more people to be able to help You at #pywikipediabot connect
Best regards, --birdy geimfyglið (:> )=| 22:52, 7 February 2008 (UTC)Reply
Thank you but, unfortunately, it didn't work. About the IRC channel, in fact, I come from there... If somebody has another idea... Thanks, anyway ! Urobore 22:58, 7 February 2008 (UTC)Reply
Some thoughts: is the page locked? Or semiblocked (and You just registered), do You have the newest version of pywikipedia (easiest is to update via tortoise). Do You have a link to this page please? --birdy geimfyglið (:> )=| 23:04, 7 February 2008 (UTC)Reply
No, the page isn't locked, nor semiblocked. However, I just found a means to resolve the problem even if I don't understand why. In fact, it is a public Wiki but blocked for non-registered users (only registered one can Edit a page). Moreover, a non-registered user can't create a new account (it means I create accounts for users who wants to participate to the wiki). Concretly, my LocalSettings.php contains :


$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;


So, I put the second line = true instead of false and it resolved the problem (the page "Abhava" has been edited).

It means I'll have to edit my LocalSettings.php each time I'll want to use a Pywikipedia. But I don't understand exactly why because the Bot has an account and should be able to edit a page without the autorization as a non-registered user : in Edit History of the page "Abhava", the Bot only appears as a non-registered IP address (mine) and not as a user. It means there should be a problem with the login of the Bot (it can't log in on the wiki and, so, is able to edit a page only as a non-registered user). So : have you got an idea about this problem of login identification of the bot ?

Thank you, anyway.

Urobore 07:10, 8 February 2008 (UTC)Reply

More than one thing to replace

edit

Is there a way to replace two or more strings at the same time? I mean: to replace at the same time "Errror" for "Error" and "Miistake" for "Mistake", without having to run the bot twice in the same category? Thank you!--Xtv 11:47, 18 September 2008 (UTC)Reply

Very intresting question. If there was such a feature, it would be very useful for me too. So is there a way? Thanks a lot! --Plasmarelais 23:37, 15 January 2009 (UTC)Reply
Yes, it's posible. Just write replace.py and then hit Enter. It will ask you what you want to replace, and you will be able to replace more than one thing in the same operation.--Unai Fdz. de Betoño 12:05, 30 August 2009 (UTC)Reply
Or you just define several replacements like
replace.py -start:! "errror" "error" "miistake" "mistake" "wroong" "wrong"
As long as you give an even number of replacements. --Plasmarelais 18:07, 30 August 2009 (UTC)Reply

Working in all namespaces

edit

How to make bot work in all namespaces using "-start"? Because when I type "-start:!" it works only in main namespace. 77.253.22.92 00:00, 20 September 2008 (UTC)Reply

Hello, for example -start:Template:! should do the trick for a specific namespace, see also the -namespace: section in Replace.py, best regards, --birdy geimfyglið (:> )=| 00:04, 20 September 2008 (UTC)Reply
But this way bot still works in one specific namespace, and I wanna make him work in all of them. And, if I understand well, -namespace cannot be used with -start, and I have to use -start, as I don't have possibility to make xml dump. 87.205.65.183 23:05, 21 September 2008 (UTC)Reply
As far as I know, Pywikipediabot doesn't support that. You have to run the bot for each namespace. Huji 17:17, 22 September 2008 (UTC)Reply
Try to use the -namespace:nn several times in one run. --Plasmarelais 18:08, 30 August 2009 (UTC)Reply

Replacing birngs new text

edit

Hi! I'm new on working with bots, but i feel myself confronted with a problem: everytime i replace one word for another, theres always an extra text coming with the new word:

   <div id="wikia-credits"><br /><br /><small>Von [http://memory-alpha.org Memory Alpha],
einer [http://www.wikia.com Wikia]-Wiki.</small></div>

How can i avoid that extra text?

Thank you very much for any help! --Plasmarelais 15:30, 13 January 2009 (UTC)Reply

I found the answer on MA/en: http://memory-alpha.org/en/wiki/Memory_Alpha:Bots. Anyway thank you! --Plasmarelais 22:23, 13 January 2009 (UTC)Reply

Additional parameters

edit

Replace.py -help shows several options which are not described on Replace.py page.

Is it working options or obsolete? e.g -uncatfiles? --Dnikitin 10:28, 17 February 2009 (UTC)Reply

You should assume that the file itself is correct. This page is probably outdated. In any case, -uncatfiles is indeed available. --Erwin(85) 19:45, 17 February 2009 (UTC)Reply
The option is a general one not specific to replace.py, it's from pagegenerators.py. -- User:D2

Infobox field samples

edit

It would be nice to have some samples for infobox field updates. -- User:D2

Question

edit

I have the next problem when I were testing the script:

python replace.py -page:Usuario:Ezarate73/pruebas -regex "[aeiou]staba más" '\1' Getting 1 pages from wikipedia:es... /home/esteban/pywikipedia1/pywikipedia/weblinkchecker.py:808: SyntaxWarning: name 'day' is assigned to before global declaration

 global day

Traceback (most recent call last):

 File "replace.py", line 705, in <module>
   main()
 File "replace.py", line 701, in main
   bot.run()
 File "replace.py", line 376, in run
   new_text = self.doReplacements(new_text)
 File "replace.py", line 344, in doReplacements
   allowoverlap=self.allowoverlap)
 File "/home/esteban/pywikipedia1/pywikipedia/wikipedia.py", line 3491, in replaceExcept
   replacement = replacement[:groupMatch.start()] + match.group(groupID) + replacement[groupMatch.end():]

IndexError: no such group

Where's the error? Thanks --Ezarate 03:35, 8 June 2009 (UTC)Reply

Replace Quotationmarks (solved)

edit

Is it possible to replace a string _including_ some quotationmarks?

I want to replace "abc" with abc. (Get rid of the quotation marks...)

Thanks alot! --91.33.247.68 05:52, 22 September 2009 (UTC) (Felix)Reply

Think you may use -regex:
replace.py -regex "\"abc\"" "abc" -start:!
if you type \" instead of " it is regonized as part of the string. --Plasmarelais 07:41, 22 September 2009 (UTC)Reply
Thank you very much! --131.234.103.164 11:06, 23 September 2009 (UTC) (Felix)Reply

Exceptinsidetag — вот из this?

edit

Could you please explain what is exceptinsidetag parametr means. What is "tag" in articles? ChVA 08:46, 31 January 2010 (UTC)Reply

The parameter makes the bot skipping pages, that contain certain text inside tags like <nowiki> etc. For example -exceptinsidetag:TEXT will skip all pages containing
Some text <nowiki>TEXT</nowiki> text.
--Plasmarelais 18:40, 31 January 2010 (UTC)Reply

-search parameter not working

edit

I'm trying to start replace.py with these parameters:

@~/Programs/pywikipedia$ python replace.py -family:wikipedia -search:"periodo de tiempo" -regex "([Pp])er([íi])odo de tiempo" "\1eríodo"

But I'm getting this error message:

Traceback (most recent call last):
  File "/home/kved/Programs/pywikipedia/pagegenerators.py", line 872, in __iter__
    for page in self.wrapped_gen:
  File "/home/kved/Programs/pywikipedia/pagegenerators.py", line 804, in DuplicateFilterPageGenerator
    for page in generator:
  File "/home/kved/Programs/pywikipedia/pagegenerators.py", line 527, in SearchPageGenerator
    for page in site.search(query, number=number, namespaces = namespaces):
  File "/home/kved/Programs/pywikipedia/wikipedia.py", line 5641, in search
    'srsearch': q,
NameError: global name 'q' is not defined
global name 'q' is not defined

I asked Drini about this and when he run on his computer the exact same parameters, the bot works!

[drini@bloqueame pywiki]$ python replace.py -family:wikipedia -search:"periodo de tiempo" -regex "([Pp])er([íi])odo de tiempo" "\1eríodo"
Getting 60 pages from wikipedia:es...
No changes were necessary in [[Cuaresma]]
No changes were necessary in [[Mes]]
No changes were necessary in [[Período Copernicano]]
No changes were necessary in [[Tiempo pascual]]
No changes were necessary in [[Prehistoria de América]]


>>> Abriles <<<
- * Periodo de tiempo correspondiente a un [[año]].
+ * Período correspondiente a un [[año]].

Do you want to accept these changes? ([y]es, [N]o, [e]dit, open in [b]rowser, [a]ll, [q]uit) 

I'm running Ubuntu 9.10 with Python 2.6.4, last revision of pywikipedia downloaded through svn from http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia/ Any ideas why the bot isn't running in my computer? KveD (talk) 02:42, 17 March 2010 (UTC)Reply

Let me translate here the French help page:
  1. The versions of Python 2.3 and before can partially work with Pywikipedia.
  2. The versions 2.4, 2.5, 2.6 are completely compatible.
  3. Python 3 and next are not compatible.
So your bug must come from elsewhere. JackPotte 21:47, 17 March 2010 (UTC)Reply
Exactly, the Python version isn't the problem. But I runned out of ideas. KveD (talk) 00:33, 18 March 2010 (UTC)Reply
Only ideas I have about is:
  • Are you both using the same version of pywikipedia framework?
  • Maybe one of you has made edits to related scripts like pagegenerators.py, wikipedia.py etc.?
  • Problems with codecs? Differences within your family-files?
Please excuse if I'm embarresing u with questions you've already found the answer for. --Plasmarelais 17:19, 2 April 2010 (UTC)Reply

find Text get it and Replace with it

edit

How can I get a text from [[en:Title]] only the Title and replace another string say {{test}} to {{test|Title}} using -regex

I found faster to develop my own script than to find if it's possible in regex. JackPotte 10:07, 19 September 2010 (UTC)Reply

Is there any way to do something like this?

edit
If {{special:editcount/{{PAGENAME}}}} > 100
replace "Text A" with "Text B".

Basically, I want to replace text but with a condition related to users' number of edits. This is for a wikia site by the way. Arciusazrael 06:26, 23 July 2011 (UTC)Reply

edit

I am making a simple text replacement via user-fixes.py. But the text replacement works everywhere, including in interwiki links, which I don't want. How may I avoid replacing texts in interwiki links? Thanks. Chaipau 07:39, 4 October 2011 (UTC)Reply

non-roman letters

edit

Is it possible somehow to replace, lets say, this: "영어(en)" with "{{en}}"  ? Kampy 09:46, 29 November 2011 (UTC)Reply

I have exactly the same question. Have tried to include the non-roman letters in a batch file and save it as UTF-8 or Unicode and run it that way, which causes the batch file to be unreadable by the command line. Has anyone had any success with replacing words with non-Latin characters? Thanks, Chaojoker (talk) 23:26, 31 July 2012 (UTC)Reply

Nothing?

edit

How do you get it so it replaces a specified text with nothing (ie. "bowl" --> "") I get the "even no. of replacements required" when I try this. 109.158.0.7 17:28, 6 December 2011 (UTC)Reply

Replacing the character "

edit

Hi there,

Is there any possibility to replace the character "? When I type in replace.py "textbefore"textafter" "textbefore"textafter" -start:! it's not working because the software thinks " was the sign for start or end of a new parmeter. If there is a possibility, it should be in the article. Also, I'm wondering wether there I can tell the bot it should replace only the first expression matching to what I typed in. Something like -onlyfirst maybe? Again, if it's possible it shuld be in the article. --Col. sheppard (talk) 11:04, 30 May 2013 (UTC)Reply

You need to escape the ", so you need to put a backslash, so it's "textbefore\"textafter" Michaelbrabec (talk) 12:41, 24 May 2015 (UTC)Reply

The replacement of two newlines by one

edit

How can I replace 3 newline characters with 2? This is to automate the removal of redundant white space. The bot says there's nothing to change when I type

python replace.py -page:XXX "\n\n\n" "\n\n"

or \r\n or \r. Yinweichen (talk) 05:57, 18 December 2013 (UTC)Reply

I'm not certain but maybe try with the -regex option. Automatik (talk) 13:33, 18 December 2013 (UTC)Reply
Solved. Command line seems to interpret \n as literally "\" + "n". Using user-fixes.py custom dictionary allows for more flexibility with the python language. It successfully finds and replaces \n.Yinweichen (talk) 17:11, 18 December 2013 (UTC)Reply

Does not work

edit

When I try to use replace script with my wiki (version Mediawiki 1.16.3) it returns File "/root/core_stable/pywikibot/data/api.py", line 526, in fetch

   assert(self._query_modules or _init)

AssertionError <type 'exceptions.AssertionError'>

edit

Hello. I am using replace.py to replace text. For example

python replace.py -links:[[APOEL]] "[[APOEL]]" "[[APOEL FC]]" -always -pt:0

but it is not working. The -links is not working.

Xaris333 (talk) 15:06, 2 August 2016 (UTC)Reply

Remove the brackets. --Leyo 13:34, 5 August 2016 (UTC)Reply

python replace.py

edit

Hello. I am using python replace.py -file:volleyball.txt "[[Εθνικός Λατσιών|" "[[Εθνικός Λατσιών (πετοσφαίριση ανδρών)|" -always -pt:0

I have a file with all articles called volleyball.txt. Where should I put this file?

Xaris333 (talk) 18:21, 29 October 2016 (UTC)Reply

I think in your current working directory. --Valerio Bozzolan (talk) 14:58, 20 November 2017 (UTC)Reply

Not in category

edit

Is there a way to exclude pages from certain (also recursive) categories? Thinking about an existing Category:Automatically generated pages with pages that I don't want to touch. --Valerio Bozzolan (talk) 16:34, 12 November 2016 (UTC)Reply

Script skips redirects

edit

Replace.py works fine, but skips alle redirect-pages. How can I fix this?

python pwb.py replace -nocase -always -start:! -onlyif:"#Redirect" A B

does not work and generates errors. --Ruud habets (talk) 19:06, 28 November 2016 (UTC)Reply

Anyone? --Ruud habets (talk) 19:26, 1 December 2016 (UTC)Reply

Android

edit

Hello, can I have a bot by android? Миллен Мичев (talk) 10:10, 18 November 2017 (UTC)Reply

You can try running Python in Android (e.g. via Termux) or you can indirectly connect from Android to your own server with Pywikibot through SSH (e.g. via ConnectBot), etc. --Valerio Bozzolan (talk) 14:57, 20 November 2017 (UTC)Reply

Download

edit

Hello. How can I download it as pyhton file?--NMW03 (talk) 17:27, 14 January 2019 (UTC)Reply

Parameter ns / namespace not working

edit

Hi all, I can't get my bot working on specific namespaces. I can use -start:File:! to have it run through that namespace. But neither

  • -ns:1
  • -namespace:1
  • -ns:Talk
  • -namespace:Talk

will work. I just get: ERROR: Unable to execute script because no generator was defined. Use -help for further information.

What ist wrong? Do I have to setup namespace in the family file? How to do this? Thank a lot in advance! --Plasmarelais (talk) 12:40, 12 November 2021 (UTC)Reply

Return to "Pywikibot/replace.py" page.