Importing Python library smtplib
I want to import the smtplib to the sikuli script I'm writing so Sikuli can send email automatically when the test is finished.
However, I encounter a problem that Sikuli cannot find the smtplib module in Python which I am sure it is installed and located in the Python27/Lib directory. Below is the code I am using. I use SikuliX 1.1.0 and Python 2.7.
-------
import smtplib
sender = '<email address hidden>'
receivers = ['<email address hidden>']
message = """From: From Person <email address hidden>
To: To Person <email address hidden>
Subject: SMTP e-mail test
This is a test e-mail message.
"""
try:
smtpObj = smtplib.
smtpObj.
print "Successfully sent email"
except:
print "Error: unable to send email"
-------
When I run it in Sikuli IDE, it gives me:
"[error] script [ send ] stopped with error in line 2
[error] ImportError ( No module named utils )
[error] --- Traceback --- error source first line: module ( function ) statement 46: smtplib ( <module> ) import email.utils
[error] --- Traceback --- end --------------"
Can anyone help? Thanks
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Gary Yiu
- Solved:
- Last query:
- Last reply: