Manual talk:Pywikibot/redirect.py

From mediawiki.org
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).

Bug with broken[edit]

Please find my bug below: my bot is administrator on fr.b (I could suppress a page manually with its account), and when I launch "redirect.py double" it works perfectly.

However, with "both" or "broken", no deletion is possible: he can see the broken redirections list, but when I enter "y" or launch the script "-always" it passes to the next entry without any page suppression.

>python redirect.py broken -v
Pywikipediabot [http] trunk/pywikipedia (r8359, 2010/07/15, 09:25:43)
Python 2.6.3 (r263rc1:75186, Oct  2 2009, 20:40:30) [MSC v.1500 32 bit (Intel)]
Retrieving special page...
==== API action:query ====
meta: userinfo
uiprop: blockinfo
----------------
Requesting API query from wikibooks:fr
Note: this language does not allow global bots.
Retrieved 52 redirects from special page.

>>> Paterson <<<
==== API action:query ====
inprop: protection|talkid|subjectid|url|readable
rvprop: content|ids|flags|timestamp|user|comment|size
prop: revisions|info
titles: Paterson
rvlimit: 1
----------------
Requesting API query from wikibooks:fr
getting huge siprop magicwords...
==== API action:query ====
meta: siteinfo
siprop: magicwords
----------------
Requesting API query from wikibooks:fr
==== API action:query ====
inprop: protection|talkid|subjectid|url|readable
rvprop: content|ids|flags|timestamp|user|comment|size
prop: revisions|info
titles: Photographie/Fabricants/Paterson
rvlimit: 1
----------------
Requesting API query from wikibooks:fr
Redirect target [[Photographie/Fabricants/Paterson]] does not exist. Do you want
 to delete [[Paterson]]? ([y]es, [N]o, [a]ll, [q]uit) y

Getting information for site wikibooks:fr
==== API action:query ====
meta: userinfo
uiprop: blockinfo|groups|rights|hasmsg|ratelimits|preferencestoken
----------------
Requesting API query from wikibooks:fr


>>> Arthur d'Arazien <<<
...

JackPotte 20:17, 17 July 2010 (UTC)Reply

After an SVN update it works. JackPotte 15:56, 9 April 2011 (UTC)Reply

Bug with double[edit]

On this dictionary the bot couldn't find the destination page, probably because of the Ă” and/or ĂŒ into its name. JackPotte 04:20, 10 August 2010 (UTC)Reply

i18n error[edit]

Hi! I was running redirect double, when I got this. I have no idea what it could be. I'running Version 9016 with ActivePython 2.7.1.4 Who can help me?

Traceback (most recent call last):
  File "C:\Python27\redirect\pywikipedia\redirect.py", line 799, in <module>
    main()
  File "C:\Python27\redirect\pywikipedia\redirect.py", line 795, in main
    bot.run()
  File "C:\Python27\redirect\pywikipedia\redirect.py", line 711, in run
    self.fix_double_redirects()
  File "C:\Python27\redirect\pywikipedia\redirect.py", line 539, in fix_double_redi
rects
    self.fix_1_double_redirect(redir_name)
  File "C:\Python27\redirect\pywikipedia\redirect.py", line 664, in fix_1_double_re
direct
    summary = i18n.twtranslate(self.site, msg_double) \
  File "C:\Python27\redirect\pywikipedia\pywikibot\i18n.py", line 220, in twtransla
te
    transdict = getattr(__import__("i18n", fromlist=[package]), package).msg
ImportError: No module named i18n

The file i18n.py is existing in the folder pywikibot, that fine. Thx a lot! --Plasmarelais 10:38, 6 March 2011 (UTC)Reply

Could you please check the folders update, for example with Tortoise in Windows (after the installation right click on the pywikipedia directory and SVN Update...)? JackPotte 12:53, 6 March 2011 (UTC)Reply

OK; I downloaded the Tortoise, installed, right click on the pywikipedia folder. It works! Thank you veryvery much, but I do not really know, what the turtle did? Just an update of the framework? I had the latest version yesterday o_O But thanks! --Plasmarelais 11:59, 7 March 2011 (UTC)Reply

$wgCapitalLinks = false;[edit]

In my setting, I had $wgCapitalLinks = false; and about a hundred double redirection from something like "Article abc" to "Page abc" to "abc". How to make the redirect.py case sensitive, or if I can't do that, what code should I change so that I can fix those double redirects? Bennylin 14:15, 6 June 2011 (UTC)Reply

Cannot fix or delete the broken redirect[edit]

Hello, when I'm trying to run this command on broken redirects, it can't delete them. I'm running it on simpsonswiki.com. It keeps coming up with the message "Cannot fix or delete the broken redirect". I have sysop powers and have given my bot these powers in the user-config and I can run delete.py okay so that's not the problem. I just can't figure out why it won't let me do this. Can anyone help? Thanks, Solar Dragon (talk) 17:28, 15 February 2015 (UTC)Reply

(I should probably note that I am running core. I am unsure whether anything would be different if you are running compat.)
As far as I can tell, this is an issue with the wording on the error message being unclear. When it says that it can't delete the redirects, it actually means that it isn't being allowed to delete the redirects due to missing the -delete argument (which I just added a note about on the script page). So, if you are still having this problem, simply adding said argument to the script call should fix it. Oscuritaforze (talk) 05:42, 25 March 2015 (UTC)Reply

Actually can't fix or delete broken redirect[edit]

Hiya, I can't seem to get this script to recognise my bot is a sysop. When I run the script with the -delete option, the "self.site.logged_in(sysop=True)" seems to return false, as far as I can tell. And if I bypass that, it simply complains that it can't delete pages. My bot can do it manually when I'm logged in. I'm not sure how to troubleshoot this from hereon in. --209.93.123.243 16:24, 26 May 2017 (UTC)Reply

Never mind, got assistance from the IRC channel. Failed to set a sysop account in user config properly. --SgtLion (talk) 16:35, 26 May 2017 (UTC)Reply