Bugs item #1168983, was opened at 2005-03-23 05:05
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1168983&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: David Carroll (vmlinuxz)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: ftplib.py string index out of range

Initial Comment:
The following code works great on all of the 2.3.x
releases I have used.

def
ftpFetch(localPath,remoteFileDate,ftpSite,ftpPass,ftpDir,ftpUser):
    print "Fetching split_mgr report"
    fileList=[]
    processList=[]
    ftp = FTP(ftpSite)
    ftp.login(ftpUser,ftpPass)               
    ftp.dir('LIST '+ftpDir,fileList.append)
    for x in range(len(fileList)):
        if (string.find(fileList[x],remoteFileDate) != -1):
            print fileList[x]
            TMP=fileList[x]
            output=localPath+str(TMP[45:])
            print output
            processList.append(output)
            print processList
            outfile = open(output,'w')
            ftp.retrbinary('RETR '+ftpDir+TMP[45:],
open(output, 'wb').write)
    ftp.quit()
    print processList
    return processList

However I get the following error under 2.4

Traceback (most recent call last):
  File
"C:\Python24\lib\site-packages\PythonCard\widget.py",
line 417, in _dispatch
    handler(background, aWxEvent)
  File "C:\Documents and
Settings\PROTECTED\Desktop\ReadWaitReport\ReadWaitReport\readwaitreport.py",
line 61, in on_btnRun_command
    mainRwclassLoop(self, mm+dd+yy, yesterday)
  File "C:\Documents and
Settings\PROTECTED\Desktop\ReadWaitReport\ReadWaitReport\rwclass.py",
line 39, in mainRwclassLoop
    processList =
ftpFetch(localPath,"split_mgr."+date[0:4],ftpSite,ftpPass,ftpDir,ftpUser)
  File "C:\Documents and
Settings\PROTECTED\Desktop\ReadWaitReport\ReadWaitReport\rwclass.py",
line 173, in ftpFetch
    ftp.dir('LIST '+ftpDir,fileList.append)
  File "C:\Python24\lib\ftplib.py", line 464, in dir
    self.retrlines(cmd, func)
  File "C:\Python24\lib\ftplib.py", line 396, in retrlines
    conn = self.transfercmd(cmd)
  File "C:\Python24\lib\ftplib.py", line 345, in
transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "C:\Python24\lib\ftplib.py", line 328, in
ntransfercmd
    if resp[0] != '1':
IndexError: string index out of range

https://lists.dulug.duke.edu/pipermail/yum/2004-August/005067.html
discusses a similar problem under Linux in the YUM
script, I have reproduced this error under 2000, and XP.

I'm a fairly new programmer, and thus very new to
python so I hope this is enough information.  I will
try and keep track of this and help out with more
information in any capacity I can.

Thank you for all your hard work and dedication.
David Carroll

----------------------------------------------------------------------

Comment By: Ilya Sandler (isandler)
Date: 2005-04-04 21:12

Message:
Logged In: YES 
user_id=971153


Could you submit a minimalistic piece of code which
illustrates the problem?
As well as any input data which are required to reproduce it?


(SourceForge garbled your original example)



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1168983&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to