FAQ
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

try:
ftp=FTP('some_server')
ftp.login()
# more lines
except:
print "An error has occured.\n"

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?

Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-list/attachments/20060730/a39abbdf/attachment.htm

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJul 30, '06 at 10:15p
activeJul 30, '06 at 10:15p
posts1
users1
websitepython.org

1 user in discussion

Matthew Little: 1 post

People

Translate

site design / logo © 2022 Grokbase