Skip to content

Commit f92a21a

Browse files
author
Richard Jones
committed
[SF#500329] exception on server not reachable-patch
1 parent fe1bcd1 commit f92a21a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

roundup-mailgw

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: roundup-mailgw,v 1.19 2002-01-05 02:19:03 richard Exp $
19+
# $Id: roundup-mailgw,v 1.20 2002-01-07 10:43:48 richard Exp $
2020

2121
# python version check
2222
from roundup import version_check
@@ -63,14 +63,18 @@ def do_mailbox(handler, filename):
6363
def do_pop(handler, server, user='', password=''):
6464
'''Read a series of messages from the specified POP server.
6565
'''
66-
import getpass, poplib
66+
import getpass, poplib, socket
6767
if not user:
6868
user = raw_input(_('User: '))
6969
if not password:
7070
password = getpass.getpass()
7171

7272
# open a connection to the server and retrieve all messages
73-
server = poplib.POP3(server)
73+
try:
74+
server = poplib.POP3(server)
75+
except socket.error, message:
76+
print "POP server error:", message
77+
return 1
7478
server.user(user)
7579
server.pass_(password)
7680
numMessages = len(server.list()[1])
@@ -169,6 +173,9 @@ if __name__ == '__main__':
169173

170174
#
171175
# $Log: not supported by cvs2svn $
176+
# Revision 1.19 2002/01/05 02:19:03 richard
177+
# i18n'ification
178+
#
172179
# Revision 1.18 2001/12/13 00:20:01 richard
173180
# . Centralised the python version check code, bumped version to 2.1.1 (really
174181
# needs to be 2.1.2, but that isn't released yet :)

0 commit comments

Comments
 (0)