Author sdaoden
Recipients georg.brandl, giampaolo.rodola, holdenweb, lregebro, pitrou, r.david.murray, rhettinger, sdaoden, vstinner
Date 2011-01-28.15:21:26
SpamBayes Score 1.21334e-06
Marked as misclassified No
Message-id <1296228087.28.0.850479917738.issue9124@psf.upfronthosting.co.za>
In-reply-to
Content
You're indeed right, i've overseen a try..catch!
I'll even be able to give you some fast code hints now
(and i'll be offline the next few hours - the mails are simply mails with illegal charsets, say):

Traceback (most recent call last):
  File "/Users/steffen/tmp/y/s-postman.py", line 1098, in <module>
    sys.exit(main())
  File "/Users/steffen/tmp/y/s-postman.py", line 1088, in main
    xclass = xclass() # Impl. class chosen upon commline args
  File "/Users/steffen/tmp/y/s-postman.py", line 951, in __init__
    self._walk()
       def _walk(self):
                verb("--dispatch: starting iteration over input boxes")
                for b, t in _Dispatch_Boxes:
                        box = open_mailbox(b, type=t, create=False)
                        try:
                                self._do_box(box)
                        except Exception as e:
                                raise
  File "/Users/steffen/tmp/y/s-postman.py", line 958, in _walk
    self._do_box(box)
        def _do_box(self, box):
                cnt = len(box)
                log("* Box contains ", cnt, " messages")
                for nr in range(cnt):
                        log("  * Dispatching message ", nr+1)
                        msg = box.get_message(nr)
                        Ticket.process_msg(msg)
                log("  @ Dispatched ", cnt, " messages, finished box")
  File "/Users/steffen/tmp/y/s-postman.py", line 982, in _do_box
    Ticket.process_msg(msg)
        @staticmethod
        def process_msg(msg):
                ticket = Ticket(msg)
                (match, ruleset, to_box) = Ruleset.dispatch_ticket(ticket)
                if not match:
                        to_box.add_ticket(ticket)
                        return
                splitter = to_box.get_archive_splitter()
                if not splitter or config.get_keep_archives():
                        to_box.add_ticket(ticket)
                        return
                log("    @ Treating ticket ", ticket._id,
                        " as archive, splitting")
                for msg in splitter(msg):
                        ticket = Ticket(msg)
                        to_box.add_ticket(ticket)
  File "/Users/steffen/tmp/y/s-postman.py", line 898, in process_msg
    to_box.add_ticket(ticket)
        def add_ticket(self, ticket, ignore_errors=False):
                efun = panic
                if ignore_errors:
                        efun = error
                log("    @ Saving ticket ", ticket.get_id(),
                        " in \"", self._ident, "\"")
                mbox = self._mailbox
                if not mbox:
                        mbox = os.path.join(config.get_folder(), self._path)
                        mbox = open_mailbox(mbox, type=self._type, create=True)
                        self._mailbox = mbox
                        try:
                                mbox.lock()
                        except Exception as e:
                                efun("Could not gain mailbox lock!")
                try:
                        mbox.add(ticket.get_msg())
                        mbox.flush()
                except Exception as e:
                        #efun("Box ", self._ident,
                        #       ": message-add failed, ",
                        #       "mails may be lost: ", str(e))
                        raise
  File "/Users/steffen/tmp/y/s-postman.py", line 680, in add_ticket
    mbox.add(ticket.get_msg())
  File "/Users/steffen/usr/lib/python3.2/mailbox.py", line 259, in add
    self._dump_message(message, tmp_file)
  File "/Users/steffen/usr/lib/python3.2/mailbox.py", line 205, in _dump_message
    gen.flatten(message)
  File "/Users/steffen/usr/lib/python3.2/email/generator.py", line 88, in flatten
    self._write(msg)
  File "/Users/steffen/usr/lib/python3.2/email/generator.py", line 141, in _write
    self._write_headers(msg)
  File "/Users/steffen/usr/lib/python3.2/email/generator.py", line 372, in _write_headers
    header_name=h)
  File "/Users/steffen/usr/lib/python3.2/email/header.py", line 197, in __init__
    self.append(s, charset, errors)
  File "/Users/steffen/usr/lib/python3.2/email/header.py", line 275, in append
    s.encode(output_charset, errors)
UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 8: ordinal not in range(128)
History
Date User Action Args
2011-01-28 15:21:27sdaodensetrecipients: + sdaoden, georg.brandl, rhettinger, holdenweb, pitrou, vstinner, giampaolo.rodola, lregebro, r.david.murray
2011-01-28 15:21:27sdaodensetmessageid: <1296228087.28.0.850479917738.issue9124@psf.upfronthosting.co.za>
2011-01-28 15:21:26sdaodenlinkissue9124 messages
2011-01-28 15:21:26sdaodencreate