I repost the original code segment to make it more complete; from ftplib import FTP try: session = FTP(ftp_server_ip,ftp_user,ftp_password) file = open(filename,'rb') # file to send session.storbinary('STOR ' + filename, file) # send the file except Exception, errObj: print Exception print errObj file.close() # close file and FTP session.quit()
On Tuesday, November 19, 2013 6:18:07 PM UTC+8, JL wrote: > I have the following code; > > > > try: > > session = FTP(ftp_server_ip,ftp_user,ftp_password) > > file = open(filename,'rb') # file to send > > session.storbinary('STOR ' + filename, file) # send the file > > except Exception, errObj: > > print Exception > > print errObj > > file.close() # close file and FTP > > session.quit() > > > > I deliberately placed an invalid ip address for the ftp_server_ip to see > whether error messages can be caught. However, no exception was thrown. Can > someone more experienced point to me what did I do wrong? > > > > Thank you. -- https://mail.python.org/mailman/listinfo/python-list