[Tutor] IMAPlib.py problem -- search

Matej Cepl cepl at surfbest.net
Thu Nov 13 17:00:23 EST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

can somebody explain me why this script fails saying that SEARCH
is BAD?

   #!/usr/bin/env python

   import imaplib, sys, re, os, popen2, getpass, getopt, string

   imapuser="somebody"
   imaphost='neumail04.neu.edu'
   imapport=143
   imappassword='something'
   imapinbox="INBOX"

   imap=imaplib.IMAP4(imaphost,imapport)
   res=imap.login(imapuser, imappassword)
   assertok(res, "login",imapuser, 'xxxxxxxx')
   res=imap.select(imapinbox, 1)
   assertok(res, 'select', imapinbox, 1)

   # it returns number of messages in response
   low=1
   high=int(res[1][0])

   # make the search
   #uids=imap.search(None,'NEW','HEADER Mailing-List ""',\
   #'NOT HEADER List-Post')
   uids=imap.search(None,r'( NEW HEADER Mailing-List "" )')
   #Mailing-List: list neu-lps-students at yahoogroups.com; \
   #contact neu-lps-students-owner at yahoogroups.com
   print uids

Thanks,

        Matej

- -- 
Matej Cepl,
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/s/774J/vJdlkhKwRAnEwAKCHaxgKIpaFVcdOJ2IKdv2v/rsYzACfWPjH
mpZ5Md0q4elw2HoqEO2awpg=
=jDGC
-----END PGP SIGNATURE-----




More information about the Tutor mailing list