Manual:Pywikibot/Windows

This page is a translated version of the page Manual:Pywikibot/Windows and the translation is 44% complete.

Python в PATH

Чтобы упростить запуск Python, исполняемый файл должен находиться в вашей переменной PATH.

Чтобы проверить, что Python установлен правильно, откройте CMD.EXE и запустите:

  C:\> python --version

Если python не найдет, переустановите Python и включите опцию для помещения python.exe в вашу PATH (переменные пространства).

Создать ярлык

Как сделать ярлык для запуска команд (для пользователей 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. Для этого выполните следующие действия:

  1. Щёлкнуть правой кнопкой на папке, в которую установлен pywikibot
  2. Нажмите «Создать ярлык». Будет создан новый ярлык в виде значка со стрелкой.

Щёлкнуть правой кнопкой на на ярлыке, выбрать «Свойства».

  1. In the properties window, in the target box type in cmd.exe.
  1. In the "start in" box enter the full address of pywikibot.
  1. Нажмите «ОК».
  1. Click the shortcut and the cmd.exe opens up with the full path listed.
  1. 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

Windows shell (cmd.exe) менее совершенна, когда речь заходит о поддержке Unicode. Поскольку Pywikibot широко используется на не-английских MediaWiki сайтах, мы поддерживаем полный вывод в формате Unicode. Если вам нужна поддержка Unicode для языка, на котором вы работаете, лучшим решением является использование ConEmu Windows console вместо родной консоли (например, 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. Запустите cmd.exe или любой скрипт pywikibot
  2. Нажмите на значок в верхнем левом углу ("C:\") или щелкните правой кнопкой мыши по строке заголовка
  3. Перейдите в раздел 'Properties'
  4. Перейдите на вкладку 'Font'.
  5. Выберите любой шрифт, у которого есть логотип TT спереди - в Windows XP, это Lucida Console; В новых версиях вы также можете выбрать Consolas.
  6. Нажмите 'ОК'.
  7. Выберите 'Сохранить настройки для всех экранов с тем же названием'

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

Changing 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:Вики!


If you need more help on setting up your Pywikibot visit the #pywikibot IRC channel подключиться or pywikibot@ mailing list.