Manual:Pywikibot/2.0/login.py

If login.py fails silently you can try this workarounds. Set the PYWIKIBOT2_DIR envirnoment variable before importing pywikibot in the then you can attempt to log in.