Python print statement in Softimage 2013


If you’re using an external install of Python, you’ll probably notice that the print statement doesn’t work in Softimage 2013. That’s because Softimage 2013 was compiled with Visual C++ 2010, and Python wasn’t.

We recompiled the built-in Python that ships with Softimage 2012, so if you use that Python, the print statement works.

Workaround courtesy of Jo benayoun:

import sys
class STDOutHook(object):
	def __init__(self):
		pass
	def write(self, data):
		# py engine adds a newline at the end of the data except if
		# the statement was ended by a comma.
		data = "" if data == "\n" else data

		if data != "":
			Application.LogMessage(data)
		return None

sys.stdout = STDOutHook()

print "Hello"
print "\n"       # wont work due to the workaround
print "World",

I found this same workaround by googling “python print redirect stdout”. For example, here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s