You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
imaplib status failed if the folder name contains whitespace.
For example,
c = IMAP4_SSL('hostname')
c = login(username, password)
c.status('Drafts', '(MESSAGES)') # would succeed
c.status('Apple Mail To Do', '(MESSAGES)') # would fail, error message is:
imaplib.error: STATUS command error: BAD [b"parse error: wrong character; expected '(' but got 'M'"]
It seems the status method could not properly parse the folder name "Apple Mail To Do", it recognizes only the first word "Apple", then failed when meeting the following word "Mail".
I checked imaplib.py, _command 's definition looks like the cause, but I am not sure:
Work around for this:
Manually add double quote around the folder name, like:
'"' + mailbox_name + '"'
BUT,
while c.status('"Apple Mail To Do"', '(MESSAGES)') worked,
c.status("'Apple Mail To Do'", '(MESSAGES)') failed. Suggesting single and double quote weighs not the same?
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: