File capisuite-0.4.5-python-v2.6.diff of Package capisuite
Index: capisuite-0.4.5/scripts/cs_helpers.pyin
===================================================================
--- capisuite-0.4.5.orig/scripts/cs_helpers.pyin
+++ capisuite-0.4.5/scripts/cs_helpers.pyin
@@ -182,7 +182,7 @@ def sendMIMEMail(mail_from,mail_to,mail_
# sff -> tif
ret=sfftotiff(attachment,basename+"tif")
if (ret or not os.access(basename+"tif",os.F_OK)):
- raise "conv-error","Can't convert sff to tif. sfftobmp not installed?"
+ raise Exception("conv-error","Can't convert sff to tif. sfftobmp not installed?")
# tif -> ps -> pdf
# the first pipe must be handled by the shell so that the output of
# of ps2pdf can be read immediately. Handling this shell in Python
@@ -190,7 +190,7 @@ def sendMIMEMail(mail_from,mail_to,mail_
command="tiff2ps -h11 -H12 -L.5 -w8.5 -a "+escape(basename+"tif")+" | ps2pdf -sPAPERSIZE=a4 - -"
tiff2pdf=popen2.Popen3(command)
if (tiff2pdf.poll()!=-1):
- raise "conv-error","Error while calling tiff2ps or ps2pdf. Not installed?"
+ raise Exception("conv-error","Error while calling tiff2ps or ps2pdf. Not installed?")
tiff2pdf.tochild.close() # we don't need the input pipe
# create attachment with pdf stream
filepart = email.MIMEBase.MIMEBase("application","pdf",name=os.path.basename(basename)+"pdf")
@@ -199,14 +199,14 @@ def sendMIMEMail(mail_from,mail_to,mail_
tiff2pdf.fromchild.close()
ret=tiff2pdf.wait()
if (ret!=0):
- raise "conv-error","Error "+str(ret)+" occured during tiff2ps or ps2pdf"
+ raise Exception("conv-error","Error "+str(ret)+" occured during tiff2ps or ps2pdf")
os.unlink(basename+"tif")
email.Encoders.encode_base64(filepart)
elif (mail_type=="cff"): # color fax file
# cff -> ps
ret=os.spawnlp(os.P_WAIT,"jpeg2ps","jpeg2ps","-m",attachment,"-o",basename+"ps")
if (ret or not os.access(basename+"ps",os.F_OK)):
- raise "conv-error","Can't convert cff to ps. jpeg2ps not installed?"
+ raise Exception("conv-error","Can't convert cff to ps. jpeg2ps not installed?")
# tif -> ps -> pdf
# the first pipe must be handled by the shell so that the output of
# of ps2pdf can be read immediately. Handling this shell in Python
@@ -214,7 +214,7 @@ def sendMIMEMail(mail_from,mail_to,mail_
command="ps2pdf -sPAPERSIZE=a4 "+escape(basename+"ps")+" -"
ps2pdf=popen2.Popen3(command)
if (ps2pdf.poll()!=-1):
- raise "conv-error","Error while calling ps2pdf. Not installed?"
+ raise Exception("conv-error","Error while calling ps2pdf. Not installed?")
ps2pdf.tochild.close() # we don't need the input pipe
# create attachment with pdf stream
filepart = email.MIMEBase.MIMEBase("application","pdf",name=os.path.basename(basename)+"pdf")
@@ -238,10 +238,11 @@ def sendMIMEMail(mail_from,mail_to,mail_
textpart = email.MIMEText.MIMEText(text)
msg.attach(textpart)
msg.attach(filepart)
- except "conv-error",errormessage:
- text+="\n\nERROR occured while converting file: "+errormessage+"\nPlease talk to your friendly administrator.\n"
+ except Exception as (errno, errormessage):
+ text+="\n\n"+errno+" occured while converting file: "+errormessage+"\nPlease talk to your friendly administrator.\n"
textpart = email.MIMEText.MIMEText(text)
msg.attach(textpart)
+ capisuite.error(errno+" occured while converting file: "+errormessage)
try:
server = smtplib.SMTP('localhost')