I am writing a simple script that attaches file to a mail, but it is not finding the file. This is my one block:
# KML attachment
filename='20140210204804.kml'
fp = open(filename, "rb")
att = email.mime.application.MIMEApplication(fp.read(),_subtype="kml")
fp.close()
att.add_header('Content-Disposition','attachment',filename=filename)
msg.attach(att)
The file 20140210204804.kml is present in the same folder as the script. I am getting below error:
IOError: [Errno 2] No such file or directory: '20140210204804.kml'
Any help is appreciated.