Handbuch:Pywikibot/Windows

From mediawiki.org
This page is a translated version of the page Manual:Pywikibot/Windows and the translation is 54% complete.

Python im PATH

Um es leichter zu machen, Python auszuführen, muss die Anwendung in deinem "PATH" sein.

Um zu überprüfen, ob Python richtig installiert wurde, öffne eine cmd.exe-Instanz und führe aus:

  C:\> python --version

Falls es python nicht findet, installiere Python neu und aktiviere die Option, um python.exe in deinem PATH (Umgebungsvariablen) einzufügen.

Eine Verknüpfung erstellen

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

Falls du Pywikibot in einen Ordner wie "Eigene Dateien" oder "Dokumente" installierst, kann es lästig sein, wiederholend den Befehl "chdir" oder "cd" zu verwenden, um in den Ordner zu gehen, um die Bots auszuführen.

Unter Windows kannst du eine Verknüpfung erstellen, die das Befehlsfeld öffnet, mit dem du Bots einfach ausführen kannst. Folge einfach die Schritte, um eines zu erstellen:

  1. Klicke mit der rechten Maustaste auf den Ordner, wo pywikibot installiert ist.
  2. Klicke auf "Verknüpfung erstellen". Ein neues Verknüpfungssymbol mit den Pfeil wird erstellt.
  3. Klicke mit der rechten Maustaste auf der neuen Verknüpfung, und klicke auf Eigenschaften.
  4. Gebe im Eigenschaftsfenster in der Ziel-Box cmd.exe ein.
  5. Gebe in der "Ausführen in"-Box die vollständige Adresse von pywikibot ein.
  6. Klicke auf "OK".
  7. Klicke die Verknüpfung und cmd.exe öffnet sich mit den gelisteten vollständigen Pfad.
    Wenn du F5 drückst, um das Fenster zu aktualisieren (oder die Eigenschaften der Verknüpfung wieder öffnest), wirst du sehen, dass das Verknüpfungssymbol sich geändert hat.

Unicode einrichten

Die Windows-Shell (cmd.exe) ist alles andere als perfekt, wenn es um Unicode-Unterstützung geht. 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.

Die Schriftart ändern
  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 ändern

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.

Transliteration support

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 connect or pywikibot@ mailing list.