5

Here is the relevant code that's causing the Error.

ftp = ftplib.FTP('server')
ftp.login(r'user', r'pass')

#change directories to the "incoming" folder
ftp.cwd('incoming')

fileObj = open(fromDirectory + os.sep + f, 'rb')

#push the file
try:
    msg = ftp.storbinary('STOR %s' % f, fileObj)
except Exception as inst:
    msg = inst
finally:
    fileObj.close()
    if '226' not in msg:
    #handle error case

I've never seen this error before and any information about why I might be getting it would be useful and appreciated.

complete error message: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

It should be noted that when I manually (i.e. open a dos-prompt and push the files using ftp commands) push the file from the same machine that the script is on, I have no problems.

8
  • 10060 looks like a timeout error. Commented Feb 9, 2011 at 15:36
  • 1
    google.com/search?q=error+10060 Commented Feb 9, 2011 at 15:37
  • nothing particularly helpful in the google search w/r/t how to handle in python. Commented Feb 9, 2011 at 16:39
  • 7
    @Ignacio, I appreciate the help. But you don't have to put your assistance in the form of a condescending question. You could have simply said: "you can't handle a server error in the client". Commented Feb 9, 2011 at 17:33
  • 3
    A timeout could be related to active/passive FTP, as the answer to this question suggests: stackoverflow.com/questions/3451817/python-ftplib-timing-out Commented Feb 10, 2011 at 20:26

2 Answers 2

1

Maybe you should increase the "timeout" option, and let the server more time to response.

Sign up to request clarification or add additional context in comments.

Comments

1

In my case, changing to ACTV mode, as @Anders Lindahl suggested, got everything back into working order.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.