ftplib throws: IndexError: tuple index out of range

Stephane Wirtel stephane at wirtel.be
Sun Feb 14 06:00:16 EST 2016


Hi Antoon,

EINTR, is an error when there is an emited signal to your process.

http://man7.org/linux/man-pages/man2/read.2.html

Look for EINTR in this page

On 02/14, Antoon Pardon wrote:
>I have written a small backup program, that uses ftplib to make
>remote backups. However recentely the program starts to regularly
>raise IndexErrors, as far as I can see the problem is in socket.py
>Can anyone shed some light?
>
>This is the traceback:
>
>Traceback (most recent call last):
>  File "/usr/local/lib/python-apps/rmtdump/pymain.py", line 93, in main
>    Exit_Nr = process(sys.argv)
>  File "/usr/local/lib/python-apps/rmtdump/rmtdump.py", line 228, in program
>    process(path)
>  File "/usr/local/lib/python-apps/rmtdump/rmtdump.py", line 170, in process
>    of = rmt.open(rmtsep.join([rmt5lcl(rt), archive]), "wb")
>  File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 198, in open
>    return ftpfile(ftp, fn, mode, True)
>  File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 69, in __init__
>    self.cnct =  self.ftp.transfercmd("%s %s" % (cmd, rfn))
>  File "/usr/lib/python2.7/ftplib.py", line 376, in transfercmd
>    return self.ntransfercmd(cmd, rest)[0]
>  File "/usr/lib/python2.7/ftplib.py", line 693, in ntransfercmd
>    conn, size = FTP.ntransfercmd(self, cmd, rest)
>  File "/usr/lib/python2.7/ftplib.py", line 339, in ntransfercmd
>    resp = self.sendcmd(cmd)
>  File "/usr/lib/python2.7/ftplib.py", line 249, in sendcmd
>    return self.getresp()
>  File "/usr/lib/python2.7/ftplib.py", line 215, in getresp
>    resp = self.getmultiline()
>  File "/usr/lib/python2.7/ftplib.py", line 201, in getmultiline
>    line = self.getline()
>  File "/usr/lib/python2.7/ftplib.py", line 186, in getline
>    line = self.file.readline(self.maxline + 1)
>  File "/usr/lib/python2.7/socket.py", line 478, in readline
>    if e.args[0] == EINTR:
>IndexError: tuple index out of range
>
>Locals by frame, innermost last
>
>Frame main in /usr/local/lib/python-apps/rmtdump/pymain.py at line 111
>           backtrace = <function backtrace at 0x7ff8c5d36230>
>                  pn = 'rmtdump'
>             process = <function program at 0x7ff8c5d361b8>
>
>Frame program in /usr/local/lib/python-apps/rmtdump/rmtdump.py at line 261
>             aborted = True
>                argv = ['/usr/local/sbin/rmtdump']
>                path = '/home'
>
>Frame process in /usr/local/lib/python-apps/rmtdump/rmtdump.py at line 190
>                b_rt = '/home'
>          backupflag = 'r--'
>         backupstamp = 1453021366
>          checkstamp = 1450374304
>                dirs = ['antoon', 'jenny', 'lost+found', 'photo']
>             entries = ['0-home', 'antoon', 'homelady', 'jenny', 'lost+found', 'photo', 'recover']
>               entry = 'recover'
>            fileinfo = posix.stat_result(st_mode=16877, st_ino=2490369, st_dev=2058L, st_nlink=5, st_uid=0, st_gid=0, st_size=4 ...
>               files = []
>                fqpn = '/home/recover'
>              islink = <function islink at 0x7ff8c9073500>
>             ismount = <function ismount at 0x7ff8c9073758>
>                last = 1455445804.979914
>               newfn = 'home/!2016-01-17 at 10_02_46-tbz'
>                 now = 1455445804
>         nr_of_tries = 0
>                  of = None
>               oldfn = 'home/!ENTRY-tbz'
>                path = '/home'
>                  rt = '/home'
>               stamp = '1450374304'
>               start = 1455445804
>              timefn = '!2016-01-17 at 10_02_46-tbz'
>               tryal = 1
>              update = True
>
>Frame open in /usr/local/lib/python-apps/rmtdump/ftputil.py at line 198
>                  fn = 'home/!ENTRY-tbz'
>                 ftp = <ftputil.FTP instance at 0x7ff8c5d3add0>
>                mode = 'wb'
>                self = <ftputil.FTP instance at 0x7ff8c5d3acf8>
>
>Frame __init__ in /usr/local/lib/python-apps/rmtdump/ftputil.py at line 69
>               bound = True
>                  ch = 'b'
>                 cmd = 'STOR'
>                  cn = <ftputil.FTP instance at 0x7ff8c5d3add0>
>               count = 1
>                mode = 'wb'
>                 rfn = 'home/!ENTRY-tbz'
>                self = None
>
>Frame transfercmd in /usr/lib/python2.7/ftplib.py at line 376
>                 cmd = 'STOR home/!ENTRY-tbz'
>                rest = None
>                self = <ftplib.FTP_TLS instance at 0x7ff8c5d4c878>
>
>Frame ntransfercmd in /usr/lib/python2.7/ftplib.py at line 693
>                 cmd = 'STOR home/!ENTRY-tbz'
>                rest = None
>                self = <ftplib.FTP_TLS instance at 0x7ff8c5d4c878>
>
>Frame ntransfercmd in /usr/lib/python2.7/ftplib.py at line 352
>                 cmd = 'STOR home/!ENTRY-tbz'
>                conn = <socket._socketobject object at 0x7ff8c5d2d2f0>
>                host = '192.110.0.54'
>                port = 64649
>                rest = None
>                self = <ftplib.FTP_TLS instance at 0x7ff8c5d4c878>
>                size = None
>
>Frame sendcmd in /usr/lib/python2.7/ftplib.py at line 249
>                 cmd = 'STOR home/!ENTRY-tbz'
>                self = <ftplib.FTP_TLS instance at 0x7ff8c5d4c878>
>
>Frame getresp in /usr/lib/python2.7/ftplib.py at line 215
>                self = <ftplib.FTP_TLS instance at 0x7ff8c5d4c878>
>
>Frame getmultiline in /usr/lib/python2.7/ftplib.py at line 201
>                self = <ftplib.FTP_TLS instance at 0x7ff8c5d4c878>
>
>Frame getline in /usr/lib/python2.7/ftplib.py at line 186
>                self = <ftplib.FTP_TLS instance at 0x7ff8c5d4c878>
>
>Frame readline in /usr/lib/python2.7/socket.py at line 478
>                 buf = <cStringIO.StringO object at 0x7ff8c5d40298>
>             buf_len = 0
>                   e = timeout()
>                self = <socket._fileobject object at 0x7ff8c7b75b50>
>                size = 8193
>-- 
>https://mail.python.org/mailman/listinfo/python-list

-- 
Stéphane Wirtel - http://wirtel.be - @matrixise



More information about the Python-list mailing list