Casey Bralla on 28 Nov 2009 10:08:30 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Where is that Python Module??


Any Python gurus out there?

I'm writing an application that has to send eMails.    I developed it on a 
computer that runs python 2.6.4 and it works just fine.

However, when I transferred it to a Debian stable computer that runs python 
2.4.4, one of the critical modules is not loaded, and I can't figure out where 
to find it, or how to load it.  Can somebody give me some advice?




Here are some critical sections of my python code:


# Import some standard python modules
import os				# misc operating system calls.
import sys				# More misc operating system calls
import time				# sleep function
from string import *			# Use string handling routines
import smtplib				# SMTP Mail handler
from subprocess import *		# The improved subprocess funtion
from email.mime.text import MIMEText	# Needed to send eMails
#



# First Create the HTML message from the detail.html file
MessageFile = open(HTMLDetailFileName,"r")
eMailMessage = MIMEText(MessageFile.read(), "html")
MessageFile.close()
#
eMailSender = "Sender@Nowhere.org"
eMailMessage['Subject'] = "System Fail Warning"
eMailMessage['From'] = eMailSender
eMailMessage['To'] = WarnRecipient

SMTPConnection = smtplib.SMTP()
SMTPConnectionResult = SMTPConnection.connect(WarnMailServer)
SMTPConnectionResult = SMTPConnection.sendmail(eMailSender, WarnRecipient, 
eMailMessage.as_string())
#
SMTPConnection.quit()



When I run this program, it bombs with:
Traceback (most recent call last):
  File "./program.py", line 40, in ?
    from email.mime.text import MIMEText        # Needed to send eMails
ImportError: No module named mime.text


OK, so I need to find the module mime.text.   Unfortunately, I can't find it 
anywhere in the Debian archives.   Anybody have a suggestion?  TIA!

-- 

Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation

http://www.NerdWorld.org
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug