title: Can't find file to send file as attachment in python
body: <p>I found this code from another website repository and its used to send emails using python and attach's a file as well. It encodes the file in to base64 brfore sending it. I've tested the code before using an '.xlsx' file and it was sent with out a problem. But now the program doesnt send it for some reason. The file is in the same folder as the code.</p>
  
  <pre><code>import smtplib
  from email.mime.multipart import MIMEMultipart
  from email.mime.text import MIMEText
  from email.mime.base import MIMEBase
  from email import encoders
  
  fromaddr = "FROM EMAIL"
  toaddr = "TO EMAIL"
  
  msg = MIMEMultipart()
  
  msg['From'] = fromaddr
  msg['To'] = toaddr
  msg['Subject'] = "SUBJECT"
  
  body = "MESSAGE"
  
  msg.attach(MIMEText(body, 'plain'))
  
  filename = "05-11-2016 - Saturday.xlsx"
  attachment = open("05-11-2016 - Saturday", "rb")
  
  part = MIMEBase('application', 'octet-stream')
  part.set_payload((attachment).read())
  encoders.encode_base64(part)
  part.add_header('Content-Disposition', "attachment; filename= %s" % filename)
  
  msg.attach(part)
  
  server = smtplib.SMTP('smtp.gmail.com', 587)
  server.starttls()
  server.login(fromaddr, "PASSWORD")
  text = msg.as_string()
  server.sendmail(fromaddr, toaddr, text)
  server.quit()
  </code></pre>
  
  <p>When i run it ths is the error that is outputted:</p>
  
  <pre><code>line 21, in &lt;module&gt;
      attachment = open("05-11-2016 - Saturday", "rb")
  FileNotFoundError: [Errno 2] No such file or directory: '05-11-2016 - Saturday'
  </code></pre>
  
  <p>Any help would be appreciated.</p>