post-render python script

   6731   4   1
User Avatar
Member
4 posts
Joined: 9月 2012
オフライン
I've got a python script that sends an email out whenever run. I want it to run whenever the renderop is completed, tried using as post-render script but it looks like it doesnt run. It's just a standard python email script. Do I have to add in anything houdini specific for it to be run?
User Avatar
スタッフ
4259 posts
Joined: 9月 2007
オフライン
As far as I know, there shouldn't be. One thing that trips me up all the time is to make sure the script type is set to Python; it's on Hscript by default.
I'm o.d.d.
User Avatar
Member
4 posts
Joined: 9月 2012
オフライン
apparently I'm getting the following error on the node:
Python error: SyntaxError: ('invalid syntax', ('<stdin>, 1, 1, sendalertmessage.py'))

Here's the code

import datetime
import socket
import smtplib
import email
import os
import mimetypes
import sys
from email import encoders
from email.message import Message
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

username = “me@mail.com
passwd = “xxxxxxx”

def mail(to, subject, text):
msg = MIMEMultipart()

msg = username
msg = to
msg = subject

msg.attach(MIMEText(text))
try:

server = smtplib.SMTP(“webmail.mail.com”, 25)
server.ehlo()
server.login(username, passwd)
try:
server.sendmail(username, to, msg.as_string())
finally:
server.close()

except Exception, exc:
sys.exit( “mail failed; %s” % str(exc) )

machine = socket.gethostname()
ftime = datetime.datetime.now().strftime(“%H:%M on %m-%d-%Y”)

mail(“me@gmail.com”, “Operation Complete”, “Operation completed on %r at %r” % (machine, ftime))
User Avatar
Member
8077 posts
Joined: 7月 2005
オフライン
The value of the parameter is Python code itself and it looks like you're simply putting in “sendalertmessage.py” in the field?

Try this instead:
execfile(“sendalertmessage.py”)
User Avatar
Member
4 posts
Joined: 9月 2012
オフライン
That did the trick!
  • Quick Links