Manual talk:Pywikibot/user-config.py

From mediawiki.org
Jump to navigation Jump to search
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

Wouldn't this be better off at MediaWiki wiki? –Juliancolton | Talk 21:02, 30 June 2009 (UTC)

Not at the moment, while there is no namespace for third-party tools on mediawiki.org.
A report would be needed to ask for opening of [[Bot: namespace. (don't know if it exists already)
On mediawikiwiki, content about bots is limited to mw:help:bots (&API). --Al Maghi 21:21, 30 June 2009 (UTC)

Error messages[edit]

C:\Users\t\Desktop\pywikipedia>python login.py

'python' is not recognized as an internal or external command, operable program or batch file.

Only login.py works.

user-config.py:

mylang = 'en'
usernames['dead-wikia.com']['en'] = u'admin'
family = dead-wikia.com

Error:

C:\Users\t\Desktop\pywikipedia>login.py
Traceback (most recent call last):
  File "C:\Users\t\Desktop\pywikipedia\login.py", line 58, in <module>
    import re, os, query
  File "C:\Users\t\Desktop\pywikipedia\query.py", line 28, in <module>
    import wikipedia, time
  File "C:\Users\t\Desktop\pywikipedia\wikipedia.py", line 143, in <module>
    from pywikibot import *
  File "C:\Users\t\Desktop\pywikipedia\pywikibot\__init__.py", line 15, in <modu
le>
    from exceptions import *
  File "C:\Users\t\Desktop\pywikipedia\pywikibot\exceptions.py", line 13, in <mo
dule>
    import config
  File "C:\Users\t\Desktop\pywikipedia\config.py", line 496, in <module>
    execfile(_filename)
  File "C:\Users\t\Desktop\pywikipedia\user-config.py", line 2, in <module>
    usernames['dead-wikia.com']['en'] = u'admin'
KeyError: '****.com'

user-config.py:

mylang = 'en'
usernames[dead-wikia.com]['en'] = u'admin'
family = dead-wikia.com

Error:

C:\Users\t\Desktop\pywikipedia>login.py
Traceback (most recent call last):
  File "C:\Users\t\Desktop\pywikipedia\login.py", line 58, in <module>
    import re, os, query
  File "C:\Users\t\Desktop\pywikipedia\query.py", line 28, in <module>
    import wikipedia, time
  File "C:\Users\t\Desktop\pywikipedia\wikipedia.py", line 143, in <module>
    from pywikibot import *
  File "C:\Users\t\Desktop\pywikipedia\pywikibot\__init__.py", line 15, in <modu
le>
    from exceptions import *
  File "C:\Users\t\Desktop\pywikipedia\pywikibot\exceptions.py", line 13, in <mo
dule>
    import config
  File "C:\Users\t\Desktop\pywikipedia\config.py", line 496, in <module>
    execfile(_filename)
  File "C:\Users\t\Desktop\pywikipedia\user-config.py", line 2, in <module>
    usernames[dead-wikia.com]['en'] = u'admin'
NameError: name 'dead' is not defined

Adamtheclown 11:23, 15 November 2010 (UTC)

Problem in my family file

I figured it out:

# -*- coding: utf-8  -*-

import family

# The official Beta Wiki.
class Family(family.Family):

    def __init__(self):

        family.Family.__init__(self)
        self.name = 'dead' #Set the family name; this should be the same as in the filename.

        self.langs = {
            'en': 'www.dead-wiki.com', #Put the hostname here.
        }

    def version(self, code):
        return "1.6.10"  #The MediaWiki version used. Not very important in most cases.

    def scriptpath(self, code):
        return '/w/index.php' #The value of {{SCRIPTPATH}} on this wiki

    def apipath(self, code):
        return '/w/api.php' #The path of api.php
        raise NotImplementedError(
            "The %s family does not support api.php" % self.name)

Adamtheclown 12:01, 15 November 2010 (UTC)

Confusing insturctions[edit]

This is really confusing. The content of the environment variable PYWIKIBOT2_DIR (core)/PYWIKIBOT_DIR (compat). Could mean one or both of these are checked and does not let you know about order. I know not supposed to put support questions here but the article needs changed. Lonjers (talk) 02:34, 2 January 2016 (UTC)

unable to login otherthan wiktionary[edit]

I am one of the sysop both in ta.wikipedia and ta.wiktionary. I can login to ta.wiktionary but unable to login ta.wikipedia. i am using compat in ubuntu distro. My user config as follows;-

# -*- coding: utf-8  -*-

mylang = 'ta'
family = 'wikipedia'
usernames['wikipedia']['ta'] = u'info-farmer'

console_encoding = 'utf-8'
use_api_login = True

Pleae, guide me?--Info-farmer (talk) 08:37, 4 October 2016 (UTC)

@Info-farmer: compat was deprecated and abandoned; it's not working anymore, the login module is broken since Autumn 2016. Try to use core, or convince someone with needed skills to fix compat :) --XXN (talk) 20:16, 20 April 2017 (UTC)
Thanks. Moving to the core.--Info-farmer (talk) 12:22, 22 April 2017 (UTC)

Can anyone create use this from their desktop PC or can this only be used on the Server hosting the wiki? Thanks! User:SamiIslam 12:58, 21 August 2017 (UTC)

Python 3.9[edit]

I feel this page needs updating as Python 3.9 is not offering user-config.py file. Shahab.bot (talk) 17:40, 15 October 2020 (UTC)