Manual:Pywikibot/Windows/ja

PythonにPATHを通す
To make it easier to run Python, the executable needs to be in your PATH.

To check Python has been installed correctly open a CMD.EXE and run:

C:\> python --version

If it does not find python, reinstall Python and enable the option to put python.exe in your PATH (environment variables).

ショートカットの作成
コマンドを実行するためのクイックショートカットを作る方法 (Windows)

If you're installing Pywikibot 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) pywikibot がインストールされているフォルダーを右クリックします.
 * 2) 「ショートカットの作成」をクリックします. 矢印付きの新しいショートカット アイコンが作成されます.
 * 3) 新しいショートカットを右クリックし、プロパティをクリックします.
 * 4) プロパティ ウィンドウで、「リンク先」のボックスに cmd.exe を入力します.
 * 5) 「作業フォルダー」ボックスに、pywikibot のインストール先のフルパスを入力します.
 * 6) 「OK」をクリックします.
 * 7) ショートカットを右クリックすると、指定したフルパスを作業ディレクトリとする cmd.exe が開きます.
 * If you press F5 to refresh the window (or re-open the shortcut's properties), you will notice that the shortcut icon has changed.

Set up Unicode
The Windows shell (cmd.exe) is less than perfect when it comes to Unicode support. Because Pywikibot is used widely on non-English MediaWiki sites, we support full Unicode output. If you need Unicode support for the language you work on, the best solution is to use ConEmu Windows console instead of the native console (i.e. cmd.exe).

However, if you decide to stick with native console you need to change the font setting in cmd.exe before this works - or else you get a lot of question marks!

Alternatively, Pywikibot also supports transliteration - for instance, Вики is transliterated to Viki on Western European systems. This also works without changing the font.

Because it is impossible to determine the font used, we ask that you explicitly define which option you want to use. If you do not define this, you will get the following warning:

 WARNING: Running on Windows and transliteration_target is not set. Please see https://www.mediawiki.org/wiki/Manual:Pywikibot/Windows

Full unicode output (suggested)
To get full unicode output, you need to change the font used by cmd.exe and add a line to user-config.py.

フォントの変更

 * 1) Start cmd.exe or any pywikibot script
 * 2) Click on the icon in the top left corner ("C:\") or right-click on the title bar
 * 3) Go to 'Properties'
 * 4) Go to the 'Font' tab
 * 5) Select any font that has the TT-logo in front - on Windows XP, this is Lucida Console; on newer versions you can also choose Consolas.
 * 6) Click 'OK'
 * 7) Choose 'Save settings for all screens with the same title'

Your cmd.exe now is able to output full unicode!

user-config.py の変更
To user-config.py, add the following line:

 transliteration_target = None

Blocks in output
Because the font is unable to display all glyphs, you will occasionally see characters like this: ☐. However, you can still copy the text to visit the page on a wiki by copy-pasting the characters.

If you'd rather have transliterated characters, please read on to the following section.

翻字への対応
If you would like to have transliterated characters instead, you can add the following line to user-config.py:

 transliteration_target = console_encoding or, if you would like to transliterate back to only ascii characters,

 transliteration_target = 'ascii' You can use any standard python encoding for this.

However, the output now is 'Viki' instead of 'Вики'. This means you cannot copy-paste the page title anymore: ru:Viki is *not* ru:Вики!