Error : 10053, 'Software caused connection abort'

- C Saha - p4sync at yahoo.com
Wed May 10 04:32:03 EDT 2006


Hi All 
   
  I have a mail function in my pythin code and seems like due to that I am getting this error when ever I am running the pythin code. Any idea, how to resolve this? 
   
  Error is = (10053, 'Software caused connection abort')
   
   
  My code is 
   
  =============================================================================
   
  "test.py"
  import os
import sys
import smtplib
  def df():
    """
    This function checks the Available space in each drive.
    """
    #Command for C drive df -k | grep /cygdrive/c | awk '{print $5}' | awk -F"%" '{print $1}'
    cmd = "df -k | grep cygdrive"#| grep /cygdrive/c | awk '{print $5}' | awk -F"%" '{print $1}'")
    text = ''
    try:
          f = os.popen (cmd + " 2>&1") 
        text = f.readlines()
        if len(text)!=0:
            drive=[]
            for i in range(0,len(text)):
                temp = text[i].split()
                if len(temp[0])==2:
                    perct = int(temp[4].rstrip("%"))
                    if perct>=20:
                        drive.append((temp[0],perct))
            if len(drive)>0:
                sendmailTo(drive)
          retval = f.close ()
        if retval!= None:
            raise Exception(text + "\nCommand '%s' failed with return value:%d" % (command, retval))
    except Exception, ex:
        print ex
  def sendmailTo(drv):
    """
    """
    
    fromaddr="sender at mail.com'
    toaddrs=['me at mail.com','you at mail.com']
    msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromaddr, ", ".join(toaddrs),"Test mail"))
    server = smtplib.SMTP('mail.smtpmail.com')
    print "TESTSSS"
    server.sendmail(fromaddr, toaddrs, msg)
    server.quit()
    
df()
   
   
  =============================================================================
   
   
   


Thanks a lot to all in advance 

====================
Thanks & Regards 
CSaha
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060510/b240eadc/attachment.html>


More information about the Python-list mailing list