简体   繁体   中英

Imaplib Select Fails while connecting folder(**Labelname) of gmail

I am using imaplib module for connecting to Gmail Imap, and i am getting the below mentioned error. I am using select command to connect

Labelname is  **LabelName 

I Get this Error:

    resp, data = self._imap.select("**LabelName")
  File "/usr/lib/python2.6/imaplib.py", line 642, in select
    typ, dat = self._simple_command(name, mailbox)
  File "/usr/lib/python2.6/imaplib.py", line 1060, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/usr/lib/python2.6/imaplib.py", line 895, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: SELECT command error: BAD ['Could not parse command']

whereas if the Labelname is

** LabelName 

It successfully connects.

Can anyone tell me what is happening here ?

Figured out the issue, while connecting using imaplib we need to connect like this:

imapobj.select('"'+ '**Foldername' + '"')

this results into select like this

"**Foldername"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM