<div class="gmail_quote">On Fri, Nov 20, 2009 at 12:38 PM, Carsten Haese <span dir="ltr"><<a href="mailto:carsten.haese@gmail.com">carsten.haese@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thank you. This proves conclusively that there IS in fact a file called<br>
email.pyc (and/or email.py) in your directory next to testMail.py. It is<br>
this email.pyc that is being imported instead of the email.py from the<br>
Python library. Getting rid of both email.py and email.pyc (by renaming<br>
them, deleting them, or moving them somewhere else) will fix your problem.<br></blockquote><div><br>Thank you! It did indeed fix that problem. Now I get this traceback:<br><br><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td bgcolor="#d8bbff"><big> </big><a href="file:///var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py">/var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py</a> </td></tr>
<tr><td><font color="#909090"><tt><small>   52</small>   session.sendmail(clientEmail, ourEmail1, header+msg)<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>   53</small> #  session.sendmail(clientEmail, ourEmail2, header+msg)<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>   54</small> <br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt><small>   55</small> mailSpreadsheet()<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt><small>   56</small> <br>
</tt></font></td></tr>
<tr><td><small><font color="#909090"><strong>mailSpreadsheet</strong> = <function mailSpreadsheet></font></small></td></tr></tbody></table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td bgcolor="#d8bbff"><big> </big><a href="file:///var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py">/var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py</a> in <strong>mailSpreadsheet</strong>()</td>
</tr>
<tr><td><font color="#909090"><tt><small>   47</small>   order += 'TOTAL: $' + str(total)<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>   48</small>   msg = 'Here is the order from %s:\n\n %s' % (string.replace(client, '_', ' '), order)<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt><small>   49</small>   session = smtplib.SMTP("localhost")<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt><small>   50</small>   session.login(user, passwd) # only if it requires auth<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>   51</small>   header = "Subject: %s \r\nContent-type: text/html; charset=utf-8\r\n\r\n" % subject<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090">session <em>undefined</em>, <em>global</em> <strong>smtplib</strong> = <module 'smtplib' from '/usr/lib64/python2.4/smtplib.pyc'>, smtplib.<strong>SMTP</strong> = <class smtplib.SMTP></font></small></td>
</tr></tbody></table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td bgcolor="#d8bbff"><big> </big><a href="file:///usr/lib64/python2.4/smtplib.py">/usr/lib64/python2.4/smtplib.py</a> in <strong>__init__</strong>(self=<smtplib.SMTP instance>, host='localhost', port=0, local_hostname=None)</td>
</tr>
<tr><td><font color="#909090"><tt><small>  242</small>         self.esmtp_features = {}<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>  243</small>         if host:<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt><small>  244</small>             (code, msg) = self.connect(host, port)<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt><small>  245</small>             if code != 220:<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>  246</small>                 raise SMTPConnectError(code, msg)<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090">code <em>undefined</em>, msg <em>undefined</em>, <strong>self</strong> = <smtplib.SMTP instance>, self.<strong>connect</strong> = <bound method SMTP.connect of <smtplib.SMTP instance>>, <strong>host</strong> = 'localhost', <strong>port</strong> = 0</font></small></td>
</tr></tbody></table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td bgcolor="#d8bbff"><big> </big><a href="file:///usr/lib64/python2.4/smtplib.py">/usr/lib64/python2.4/smtplib.py</a> in <strong>connect</strong>(self=<smtplib.SMTP instance>, host='localhost', port=25)</td>
</tr>
<tr><td><font color="#909090"><tt><small>  305</small>         if not self.sock:<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>  306</small>             raise socket.error, msg<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt><small>  307</small>         (code, msg) = self.getreply()<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt><small>  308</small>         if self.debuglevel > 0: print>>stderr, "connect:", msg<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>  309</small>         return (code, msg)<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090">code <em>undefined</em>, <strong>msg</strong> = 'getaddrinfo returns an empty list', <strong>self</strong> = <smtplib.SMTP instance>, self.<strong>getreply</strong> = <bound method SMTP.getreply of <smtplib.SMTP instance>></font></small></td>
</tr></tbody></table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td bgcolor="#d8bbff"><big> </big><a href="file:///usr/lib64/python2.4/smtplib.py">/usr/lib64/python2.4/smtplib.py</a> in <strong>getreply</strong>(self=<smtplib.SMTP instance>)</td></tr>
<tr><td><font color="#909090"><tt><small>  349</small>             if line == '':<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>  350</small>                 self.close()<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt><small>  351</small>                 raise SMTPServerDisconnected("Connection unexpectedly closed")<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt><small>  352</small>             if self.debuglevel > 0: print>>stderr, 'reply:', repr(line)<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>  353</small>             resp.append(line[4:].strip())<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090"><em>global</em> <strong>SMTPServerDisconnected</strong> = <class smtplib.SMTPServerDisconnected></font></small></td></tr></tbody></table><strong>SMTPServerDisconnected</strong>: Connection unexpectedly closed
<br><tt><small>     </small> </tt>args =
('Connection unexpectedly closed',)


<br><br>Why did this connection close? How do I fix it?<br>TIA,<br>V<br></div></div>