Can not understand the error code in ftputil

2.1k Views Asked by At

I am new to ftputil module of python.I have 2 FTP accounts on my web server. while just trying it, i encountered two problems:
1. while logging into account 1, I can get into there successfully

host = ftputil.FTPHost('ftp.mysite.com', 'user1', 'passwd1')

But whenever I tried to logging into another account, it raises and error:

ftputil.ftp_error.PermanentError: 530 Login incorrect.

However, I have problems too whenever I successfully log on. I tried out to list the directories using following commands:

name=host.listdir(host.curdir)

but instead showing off the directories, it raises an error something kinda this:

    in _try_with_oserror
        raise FTPOSError(*exc.args)
    ftputil.ftp_error.FTPOSError: 110
    Debugging info: ftputil 2.4.1, Python 2.7.3 (linux2)

what is wrong with my coding?

2

There are 2 best solutions below

0
jgritty On

Perhaps you should try a more recent version of the ftputil module.

It may have had a bug according to this.

1
Burhan Khalid On

Have you tried using the standard ftplib module?

from ftplib import FTP

try:
    ftp = FTP('ftp.mysite.com', 'user1', 'passwd1')
except ftplib.error_perm, msg:
    print 'Error: ', repr(msg)

try:
    ftp.dir()
except ftplib.error_perm, msg:
    print 'Error: ', repr(msg)