[ftputil] Problem with session_factory: __init__() takes at most 5 arguments (6 given)

Marco Buccini buccini.marco at alice.it
Mon Mar 17 13:54:10 CET 2008


Hi all!!
This is my first message here, and I would compliment with you ;)

However, I'm developing a little ftp client for personal use, using 
ftputil library, very simple and useful.

But now I've a little problem:

I've this class:

class ActiveFTPSession(ftplib.FTP):
    def __init__(self, host, userid, password):
        ftplib.FTP.__init__(self)
        self.connect(host, port)
        self.login(userid, password)
        # see http://docs.python.org/lib/ftp-objects.html
        self.set_pasv(False)

and this:

class FTPConnection(object):
    def __init__(self, host, userid, password, port, session_factory):
       
        self.host = host
        self.userid = userid
        self.password = password
        self.port = port
        self.session_factory = session_factory

        try:
            self.connection = ftputil.FTPHost(self.host, self.userid,
                     self.password, self.port, self.session_factory)

        except ftputil.FTPError, e:
            print "Errore"
            print e

When I try to run the main:

try:

        fc =  FTPConnection(HOST, USERID, PASSWORD, PORT, ActiveFTPSession)

except Exception, e:
        raise FTPConnectionError("Non e` stato possibile effettuare "\
                                    "la connessione:\n%s" % e)
        quit()

I receive this error:

Traceback (most recent call last):
  File "main.py", line 37, in <module>
    "la connessione:\n%s" % e)
src.FTPConnection.FTPConnectionError: Non e` stato possibile effettuare 
la connessione:
__init__() takes at most 5 arguments (6 given)

It's saying me that I pass 6 arguments instead of 5.
What's the matter?

Thank you ;)


More information about the ftputil mailing list