← Back to team overview

sikuli-driver team mailing list archive

[Bug 1459731] Re: ImportError: cannot import name fix_eols

 

I'm not sure whether this is important but there is also:

if getBundlePath() not in sys.path:
    bundle_path = getBundlePath()
    sys.path.append(bundle_path)

addImagePath(getBundlePath())


So, well, I'll put whole contents of openandconnect.py and testmail.py scripts:

### openandconnect.py starts here ###
if getBundlePath() not in sys.path:
    bundle_path = getBundlePath()
    sys.path.append(bundle_path)

addImagePath(getBundlePath())

from testmail import TestMail

print TestMail.get()
### openandconnect.py ends here ###

### testmail.py starts here ###
import email
import imaplib
import string
        

class TestMail():

    @staticmethod
    def get():

        def get_first_text_block(email_message_instance):
            maintype = email_message_instance.get_content_maintype()
            if maintype == 'multipart':
                for part in email_message_instance.get_payload():
                    if part.get_content_maintype() == 'text':
                        return part.get_payload()
            elif maintype == 'text':
                return email_message_instance.get_payload()

        mail = imaplib.IMAP4_SSL('imap.gmail.com')
        mail.login('foobarbaz@xxxxxxxxx', 'foobarbaz')
        mail.select("inbox")
        result, data = mail.search(None, "ALL")
        ids = data[0] # data is a list.
        id_list = ids.split() # ids is a space separated string
        latest_email_id = id_list[-1] # get the latest
        result, data = mail.fetch(latest_email_id, "(RFC822)") # fetch the email body (RFC822) for the given ID
        raw_email = data[0][1]
        email_message = email.message_from_string(raw_email)
        return ' '.join(get_first_text_block(email_message).split())
### testmail.py ends here ###

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1459731

Title:
  [1.1.0] ImportError: cannot import name fix_eols having utils.py in
  the project folder

Status in Sikuli:
  In Progress

Bug description:
  Hello!

  I just put here few lines from the command line:

  (Pdb) import email
  (Pdb) email.message_from_string('test') 
  *** ImportError: cannot import name fix_eols
  (Pdb) from email.parser import Parser
  *** ImportError: cannot import name fix_eols

  I put these lines into the sikuli script:

  import pdb
  pdb.set_trace()

  I've tried with java1.6 and java1.8. Sikuli version: 1.1.0,
  2015-05-25_01:00nightly

  I'm not sure whether this issue totally relates to the sikuli but just
  in case.

  
  Thank you!

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1459731/+subscriptions


References