Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104505
| From | cl@isbd.net |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | How to program round this poplib error? |
| Date | 2016-03-10 12:04 +0000 |
| Message-ID | <nf48rc-ncl.ln1@esprimo.zbmc.eu> (permalink) |
I have a (fairly simple) Python program that scans through a
'catchall' E-Mail address for things that *might* be for me. It sends
anything that could be for me to my main E-Mail and discards the rest.
However I *occasionally* get an error from it as follows:-
Traceback (most recent call last):
File "/home/chris/.mutt/bin/getCatchall.py", line 65, in <module>
pop3.dele(i+1)
File "/usr/lib/python2.7/poplib.py", line 240, in dele
return self._shortcmd('DELE %s' % which)
File "/usr/lib/python2.7/poplib.py", line 160, in _shortcmd
return self._getresp()
File "/usr/lib/python2.7/poplib.py", line 132, in _getresp
resp, o = self._getline()
File "/usr/lib/python2.7/poplib.py", line 377, in _getline
raise error_proto('line too long')
poplib.error_proto: line too long
Does anyone have any idea how I can program around this somehow? As
it is at the moment I have to go to the webmail system at my ISP and
manually delete the message which is a bit of a nuisance.
The piece of code that produces the error is as follows:-
#
#
# Read each message into a string and then parse with the email module, if
# there's an error retrieving the message then just throw it away
#
try:
popmsg = pop3.retr(i+1)
except:
pop3.dele(i+1)
continue
The trouble is that the error is (presumably) some sort of buffer size
limitation in pop3.dele(). If I trap the error then I still can't get
rid of the rogue E-Mail and, more to the point, I can't even identify
it so that the trap could report the error and tell me which message
was causing it.
I guess one way to get around the problem would be to increase
_MAXLINE in /usr/lib/python2.7/poplib.py, it's on my own system so I
could do this. Can anyone think of a better approach?
--
Chris Green
ยท
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
How to program round this poplib error? cl@isbd.net - 2016-03-10 12:04 +0000
Re: How to program round this poplib error? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-10 12:30 +0000
Re: How to program round this poplib error? cl@isbd.net - 2016-03-10 14:07 +0000
Re: How to program round this poplib error? Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-03-10 13:23 +0000
Re: How to program round this poplib error? cl@isbd.net - 2016-03-10 14:09 +0000
Re: How to program round this poplib error? dieter <dieter@handshake.de> - 2016-03-11 10:06 +0100
csiph-web