Where O Where Could My VARIABLE Be?

Ben Ocean zope at thewebsons.com
Fri May 4 10:42:13 EDT 2001


Hi;
Why does this send me a blank email when the file has information??
 >>>
#!/usr/bin/python

import cgi, os
import string
import smtplib

print "Content-type: text/html\n\n"
file = open("outfile.txt", "r")
line = file.readline()
file.close()
server = smtplib.SMTP("localhost")
server.sendmail("beno at thewebsons.com", "beno at thewebsons.com", line)
server.quit()
<<<
...when *this* will send me an email with the word *line*...
 >>>
#!/usr/bin/python

import cgi, os
import string
import smtplib

print "Content-type: text/html\n\n"
file = open("outfile.txt", "r")
line = file.readline()
file.close()
server = smtplib.SMTP("localhost")
server.sendmail("beno at thewebsons.com", "beno at thewebsons.com", "line")  # 
note the only difference is here
server.quit()
<<<
...and *this* will print the entire contents of the file to the screen (and 
send me a blank email)???
 >>>
#!/usr/bin/python

import cgi, os
import string
import smtplib

print "Content-type: text/html\n\n"
file = open("outfile.txt", "r")
line = file.readline()
file.close()
print line #### note this is the only additional line
server = smtplib.SMTP("localhost")
server.sendmail("beno at thewebsons.com", "beno at thewebsons.com", line)
server.quit()
<<<
PLEASE point out what small, stupid error I'm not seeing!
TIA,
BenO





More information about the Python-list mailing list