the first arg to super() must be a type, not a class obj?

metaperl metaperl at
Fri Sep 8 01:37:17 CEST 2006

On p.282 of "Python Cookbook" and in the Python docs on calling super:

it is clear that the first argument to super is a class and not a type.
However, for the code below, I am getting an error when attempting to
provide a class as my first argument and don't understand why. Also,
since this is my first attempt at writing anything of any seriousness
in Python, any other feedback is welcome.

from ftputil import *
import re

from urlparse import urlparse

class ftputilx(FTPHost):
    parms = {
        'user': '',
        'pass': '',
        'site': '',
        'path': '',
        'file': '',
        'action': '',
        'lcd': '',
        'autogo': True,
        'debuglevel': 0,
        'type': 'b'

    def bindparms(self, **kwargs):
        for k, v in kwargs.items():
            self.parms[k] = v

    def __init__(self, url, **kwargs):
        _s, site, self.parms['path'], _p, _q, _f = urlparse(url)
        if '@' in site:
            rxs = r'(.+):(.+)@(.+)'
            rxc = re.compile(rxs)
            rxm = rxc.match(site)
            (kwargs['user'],kwargs['pass'],kwargs['site']) =,,
        super(ftputilx, self).__init__()

if __name__ == '__main__':
    ftp =
    print ftp.listdir(ftp.curdir)

More information about the Python-list mailing list