Manual talk:Pywikibot/replace.py

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

Bug
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)
 * forgot to sign drini &#9742; 23:49, 10 March 2006 (UTC)

Problem
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)


 * 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)

Cat-based replace
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)


 * 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)

Finding pages
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)


 * 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)


 * 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)


 * Update: weblinkchecker.py also reports "Article_X does not exist"... --GrandiJoos 08:06, 11 September 2006 (UTC)


 * Fix: in localsettings add

$wgGroupPermissions['bot' ]['export']          = true; Thanks to Andre Engels. --GrandiJoos 11:07, 2 October 2006 (UTC)

Problem with utf-8
한국 월드컵 미국 나비

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)

Bot problem (korean language)

 * 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:

http://ko.wikipedia.org/wiki/%EC%8A%A4%EB%AA%A8%EA%B7%B8


 * 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>


 * korean lanuage is broken...:(
 * help~!! :( -- WonYong ( Talk / Contrib ) 11:49, 11 September 2006 (UTC)
 * 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)

regex BUG
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
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.

Correct command for interwiki purposes
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)