These instructions work with the version current on the pywikipedia download server as of Sept. 2007. I have noticed some instructions for older versions of pywikipedia which do not work due to changes in the way families work.

Also, this is a cross platform tool- it runs on Macs and Unix boxes. The following has some notations in regards to Windows boxes, but there is nothing here dependent on Windows to run. Perhaps the help can be made cross platform notes (eg how to run things from a command line, folder notation etc.) by anyone with a linux or apple box.

Please feel free to change/ improve this help text. I am perhaps too familiar with the system to know what parts require further explanation. ~ Phlox 18:39, 20 September 2007 (UTC)

Quick refresher to Pywikipedia if you are already set up[]

  • Editor: You use Idle- Python Gui to edit files. You will find this on the start menu->programs->Python2.5->IDLE. It's a good idea to use it rather than something else, because other text editors can mess up the indentation or Unicode characters.
  • Python is odd in that indentation is meaningful. You can break a script simply by inserting a tab or space in error. Be careful with indents.
  • How to run:
    1. Click on desktop icon for “Idle- Python GUI”- looks like a snake
    2. Open module something. Something could be:
    3. Hit F5 to run, or select menu option “Run”
  • How to run from the command line:
    • In the directory C:\Python25\pywikipedia type:
  • How to find stuff
    • highlight text you want to look for in all files. Select Edit->find in files <OR> Alt-F3.

Setup gotchas[]

  • You have to run login at least once per wiki site. IF YOU FORGET THIS- PYWIKIPEDIA will appear to work, but do stuff like refuse to save, then spit out a bunch of debugging information including html. You might assume your installation is bad or you downloaded a buggy version. Nope. You aren't logged in. That's all. Check your pywikipedia\login-data directory. If you do not see a file, then you need to run login. CD to the pywikipedia directory. Then type -family:genealogy -lang:en. You should then see the above file in your login directory.

Common operations examples[]

Operands for all commands are documented in the header of each file- eg or Play with them, but try them on single pages before doing a global search and replace.

Panic button- if a bot run starts and you want to quickly abort it, Just close the window- the cmd window or the IDLE window.

Cat move[]

  • ..\python.exe move "-from:Lists of People by Surname" "-to:Surnames"

Regular expressions example[]

You can search and replace text. Here's a simple example. From the command line:

C:\Python25\pywikipedia>..\python -page:User:OttoBot Errror Error

What it does: Loads up only the page User:OttoBot. Changes everything matching Errror to Error.

Naturally, Python supports regular expressions and very complicated transformations are possible.

Following seems to be broken in latest release "Even number of parameters required":

Now say you want to do a bunch of regular expression changes. Create the following file and name it

 import replace
import sys
import login

Hit F5 and watch it party on the page.

Installation and configuration[]

1. Download and install Python (either 2.5 or 2.4 is fine)
2. Download Pywikipedia and install as a subdirectory of your python directory eg C:\Python25\pywikipedia
3. It needs to know how to log onto your wikia. You need to add what is known as a family file. This is done by adding a [sitename].py file to the family subdirectory. EG. In the case of Genealogy wikia, you make a file C:\Python25\pywikipedia\families\ You will notice the following is exactly like other files in this directory with the only difference those portions highlighted in red.:
# -*- coding: utf-8  -*-

import family

# wikia Genealogy

class Family(family.Family):
    def __init__(self):
        self.langs         = { 'en': '', }
	self.namespaces[4] = {
	    '_default': [u'Genealogy', self.namespaces[4]['_default']],
	self.namespaces[5] = {
	    '_default': [u'Genealogy talk', self.namespaces[5]['_default']],
    def version(self, code):
        return "1.10"
    def path(self, code):
        return '/wiki/index.php'

4. Tell Pywikipedia which wiki to log onto. For this, you change entries in your file (EG location C:\Python25\pywikipedia\ I just make up one for each wiki I use- commons, wikipedia, and genealogy and copy then to and save when I want to switch. Or you could comment strings out. Whatever. The file should look like this. Change "OttoBot" to your bot name. Change "genealogy" if using with a different wikia. This string must match the one you specified in the Family file in step 3.
mylang = 'en'
family = 'genealogy'
usernames['genealogy']['en'] = u'OttoBot'
console_encoding = 'utf-8' 
5. You should be good to go. If you skip login, you may fail on your first try. See the example script example in the "Using pywiki" section.