I'm new to Python and I am writing a simple FTP client. I am having trouble handling errors like connection refused, invalid username or password, and the like. I can use a try exception block like this<br><br>try:<br> ftp=FTP('some_server')
<br> ftp.login()<br> # more lines<br>except:<br> print "An error has occured.\n"<br><br>This works fine to supress the errors, but I would like to be able to narrow the errors down so that I can print 'invalid username or password' or 'connection refused' rather than simply 'An error has occured'. How would I go about narrowing down which errors occur?
<br><br>Thanks in advance<br>