Manual:Pywikipediabot/Installation

From MediaWiki.org
Jump to: navigation, search
Bote Boas Vindas2.png
Pywikipediabot
Quick overview
Quick Start Guide
Installation
Installation (Mac)
Configuration
user-config.py
Non-Wikimedia wikis
Basic use
Scripts
Development
Further help

v  d  e

If you need more help on setting up your pywikipediabot visit the irc channel #pywikipediabotconnect @ freenode server or pywikipediabot mailing list.

Contents

[edit] Initial setup

The two things to do are:

  1. Download Python
  2. Download pywikipedia.

You do not need to "install" pywikipedia to be able to make use of it. You can actually just run it from the directory where you unpacked it or where you have your copy of the SVN sources.

[edit] Download Python

Requirement: To run PyWikipediaBot, Python v2.5 or higher is required, but Python v3.x isn't currently supported.

  • For Windows, download the latest Python v2.x here (not 3.x version!) Install the program.
  • For Mac and Unix, Python is already present on Mac OS X and on some Unix versions (although it might be necessary or recommended to update it if you have a very old version).

[edit] Download PyWikipedia

The easiest way to download pywikipedia is to use the latest nightly release. Just download the pywikipedia zip file to your computer and decompress the file - there is no further installation required.


[edit] Download PyWikipedia with SVN

Use SVN (subversion.apache.org) to retrieve an up-to-date version of PyWikipedia.

Windows: TortoiseSVN is advised.

Mac: follow these instructions to install SVN. Linux users can also follow the instructions below, but removing the $ symbol in terminal.

[edit] Examine the source code

To examine the source code using the command line SVN client use this command:

svn checkout http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia/ pywikipedia

Or, if you wish to omit the spell-checking files (saves time), add --ignore-externals:

svn checkout --ignore-externals http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia/ pywikipedia

With either of those commands the source code will be in a new directory inside your current working directory named pywikipedia (the last argument is used as the destination directory).

For graphical tools, the only information needed is the repository path: http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia/

[edit] Shortcut in command line

To allow your source code to be developed outside of the pywikipedia source directory, add something like:

PYTHONPATH=$PYTHONPATH:~/pywikipedia/
export PYTHONPATH

to a file that gets run on login, usually ~/.bashrc - this avoids typing the export PYTHONPATH part in each time you log in. Naturally, change paths to match your installation.

[edit] Windows users: create a shortcut

How to make a quick shortcut to run commands (Windows users):

If you're installing PyWikipediaBot in a folder such as "My Documents" it may be troublesome to repeatedly use the "chdir" command to go into the folder to run the bots.

On Windows you can create a shortcut which will open the command box which you can use to run bots easily. Just follow these steps to create one:

  1. Right click the folder pywikipedia is installed in.
  2. Click "Create shortcut". A new shortcut icon with the arrow key will be created.
  3. Right click on the new shortcut, and click properties.
  4. In the properties window, in the target box type in cmd.exe.
  5. In the "start in" box enter the full address of pywikipedia.
  6. Click "OK".
  7. Click the shortcut and the cmd.exe opens up with the full path listed.
    If you click properties again on this shortcut, you will notice that the shortcut icon has changed.

[edit] Updating

  • If you installed using SVN, updating your working copy is easy. Place yourself in your pywikipedia directory, and simply type
svn update

It will simply update the framework to include the latest changes. Read svn Manual for more details.

  • If you are using a nightly version, the process is a bit more complicated. You have to re-download a full copy from [1]. Before installing it, backup your configuration files and scripts (user-config.py, any family file, or custom script that you might have created, and any current dump xml file you're using for a wiki). Replace your pywikipedia directory by the new version you just downloaded. Restore your configuration files. If you're not sure of what you're doing, do not erase but keep a backup of your complete old pywikipedia directory, to avoid losing any important files.

[edit] Automatic Updating on Tool Server

For automatic updating you can make update bash file and put it in root and fill it with these commands:

#!/bin/bash
cd /home/username/pywikipedia
svn update

and then run crontab -e and enter the following to make your bot to run every day at 00:00AM (midnight):

0 0 * * * bash /home/username/update >/dev/null 2>&1

Notice: in these cods username is your username.

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox