Email Error help me with syntax error
Question: 
    import smtplib  
    from email import encoders
    from email.message import Message
    from email.mime.audio import MIMEAudio
    from email.mime.base import MIMEBase
    from email.mime.image import MIMEImage
    from email.mime.multipart import MIMEMultipart
    from email.mime.text import MIMEText
    msg = MIMEMultipart()
    msg.attach(MIMEText(file("P:/Email/test.txt").read()))
    
    
    
    sender = 'sender@email.com'  
    reciever  = 'reciever@email.com'  
    msg = 'Hello'  
    
    
    # Credentials (if needed)  
    username = 'user'  
    password = 'pass'  
    
    # The actual mail send  
    server = smtplib.SMTP('localhost')  
    server.starttls()  
    server.login(username,password)  
    server.sendmail(sender, reciever, msg)  
    server.quit()  
    

Traceback (most recent call last): File "attach2.py", line 27, in  
server.sendmail(sender, reciever, msg) File "C:\Python33\lib\smtplib.py", line
775, in sendmail (code, resp) = self.data(msg) File
"C:\Python33\lib\smtplib.py", line 516, in data q = _quote_periods(msg) File
"C:\Python33\lib\smtplib.py", line 167, in quote_periods return
re.sub(br'(?m)^.', b'..', bindata) File "C:\Python33\lib\re.py", line 170, in
sub return _compile(pattern, flags).sub(repl, string, count) TypeError:
expected string or buffer

why am i seeing this error message. is there something wrong with my python
library file?


Answer: The previous line is missing a closing parenthesis.

    
    
    ...
    msg = MIMEMultipart()
    msg.attach(MIMEText(file("P:/Email/test.txt").read())) # line missing a parenthesis
    
    sender = 'whosends@something.com'
    ...
    

