[New-bugs-announce] [issue23323] Issue with imaplib and append messages passing a tuple with flags

Alessio report at bugs.python.org
Mon Jan 26 13:41:03 CET 2015


New submission from Alessio:

In example when appending a message with more than one flag in a tuple with imaplib:

print flags
('\\Answered', '\\Seen')

connection.append('INBOX', flags, date, msg)


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-42-832414ffe4b5> in <module>()
----> 1 connection.append('INBOX', flags, date, msg[1][0][1])

/usr/lib/python2.7/imaplib.py in append(self, mailbox, flags, date_time, message)
    326         if flags:
    327             if (flags[0],flags[-1]) != ('(',')'):
--> 328                 flags = '(%s)' % flags
    329         else:
    330             flags = None

TypeError: not all arguments converted during string formatting


When I have only one flag to append:

print flags
Out[70]: ('\\Answered',)

connection.append('INBOX', flags, date, msg)
Out[74]: ('OK', ['[APPENDUID 1 1012] APPEND completed'])

Any ideas?

Thanks

----------
components: Library (Lib)
messages: 234738
nosy: Pilessio
priority: normal
severity: normal
status: open
title: Issue with imaplib and append messages passing a tuple with flags
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23323>
_______________________________________


More information about the New-bugs-announce mailing list