On 2022-10-13 13:47, Chris Green wrote:
I have a short python3 program that collects E-Mails from a 'catchall'
mailbox, sends the few that might be interesting to me and dumps the
rest.
It has suddenly (after working for some years) started throwing the
following:-
Traceback (most recent call last):
File "/home/chris/.mutt/bin/getCatchall.py", line 83, in <module>
pop3.pass_('brzmilla')
File "/usr/lib/python3.10/poplib.py", line 218, in pass_
return self._shortcmd('PASS %s' % pswd)
File "/usr/lib/python3.10/poplib.py", line 181, in _shortcmd
return self._getresp()
File "/usr/lib/python3.10/poplib.py", line 157, in _getresp
raise error_proto(resp)
poplib.error_proto: b'-ERR internal server error'
The section of code throwing the error is as follows:-
#
#
# Connect to the POP3 server, get message count, exit if no messages
#
for t in range(10): # retry 10 times
try:
pop3 = poplib.POP3_SSL('mail3.gridhost.co.uk',timeout=300)
break
except TimeoutError:
if t == 9:
log.err("Timed out 10 times, giving up")
exit(1)
else:
log.warn("Timed out, try " + str(t))
pop3.user('catch...@isbd.net')
pop3.pass_('brzmilla')
numMessages = len(pop3.list()[1])
if (numMessages == 0):
break
It seems to be saying that the POP3 server has a problem, if so there's not
much I can do about it as it's my hosting provider's mail server. Is it
really saying the server has a problem?
As you've already ascertained that it's a server error, I'd just like to
suggest that you add a sleep before retrying. If it has timed out after
5 minutes, I doubt there's much point in retrying immediately.
--
https://mail.python.org/mailman/listinfo/python-list