< Manual:Pywikibot‎ | Compat
Other languages:
Bahasa Indonesia English Türkçeespañol français polski češtinaΕλληνικά български русский العربية中文 日本語
Pywikibot compat is deprecated. Users still using compat should migrate to core.
Pywikipediabot (then "Pywikibot") was started back in 2002. In 2002 MediaWiki didn't have an api so pywikibot used screen scraping to interact with MediaWiki. In 2007 a new branch (rewrite, now core) was started from scratch using the (then new) MediaWiki api. Over the years core got more mature and most scripts were migrated. In 2013 core surpassed compat in number of changes. In 2015 the developers of Pywikibot decided to deprecate the compat version of Pywikibot and discontinue support for compat (see phab:T99365 and phab:T101214). MediaWiki 1.27 was the last release supported by compat branch (see phab:T150613).
Using scripts
If you're just using Pywikibot scripts you can just install Pywikibot core. Most scripts have been migrated. Pywikibot core uses a wrapper to run all the scripts. If you are using standard scripts (like redirect.py), you can run it in core by using pwb.py. For example:
$ python pwb.py redirect #instead of python redirect.py
Migrating code
If you wrote scripts based on compat, there is a conversion in core which helps you to migrate. And there is a script that automatically port your compat-based scripts to core.
If you have problems converting your code get in touch with us so we can help you.
Known caveats
pywikibot.Site().dbName() no longer adds the '_p' suffix, so if you are using a MySQL library to connect to a WMF Labs database, you must add '_p' manually to the end of the database name. For example:
mysqldb​.​connect​(​"testwiki.labsdb"​, db = pywikibot​.​Site​()​.​dbName​() + "_p", user = config.db_username, passwd = config.db_password)
Blocking bugs?
If you have seen any blocking bug that doesn't let you run your script in core, please file a bug in Phabricator (if it's not there yet) and mention it in phab:T99365.
Last edited on 19 May 2021, at 11:04
Content is available under CC BY-SA 3.0 unless otherwise noted.
Privacy policy
Terms of Use
 Home Random Log in  Settings  Donate  About MediaWiki.org  Disclaimers