VBScript compilation errors with Python PPG logic


On a machine that has Softimage 2011 or 2011 SP1 installed, but not Python, you’ll get VBScript compilation errors when you run a script or plugin that uses Python for the PPGLayout.Logic of a dynamic (on-the-fly) property. For example, running this script

xsi = Application
oRoot = xsi.ActiveSceneRoot
oProp = oRoot.AddProperty("CustomProperty", False, "test")
oLayout = oProp.PPGLayout
oLayout.Language = "Python"
oLayout.Logic ="""
Application.LogMessage('Hello world')
"""
xsi.InspectObj( oProp )

will give this VBScript syntax error:

# ERROR : Syntax error - [line 2]
# ERROR : Property Page Script Logic Error (Microsoft VBScript compilation error)
# ERROR :    [1] (null)
# ERROR :   >[2] Application.LogMessage('Hello world')
# ERROR :    [3] (null)
# ERROR : 	Syntax error

This happens because Softimage 2011 doesn’t detect the Python installed with Softimage, so it falls back to the default VBScript when it tries to execute the Python PPG.Logic code. However, Python works as usual in all other respects (note that the above errors are logged as Python comments!).

You can workaround this by setting PPGLayout.Language to “pythonscript”.

Or you could leave the Language set to “Python” and add these registry entries to your system.
This way you don’t have to update existing code.

[HKEY_CLASSES_ROOT\Python]
@="Python ActiveX Scripting Engine"

[HKEY_CLASSES_ROOT\Python\CLSID]
@="{DF630910-1C1D-11d0-AE36-8C0F5E000000}"

[HKEY_CLASSES_ROOT\Python\CurVer]
@="Python.AXScript.2"
[HKEY_CLASSES_ROOT\Python\OLEScript]

To add the registry entries, save the above in a .reg file and then double-click it.

3 thoughts on “VBScript compilation errors with Python PPG logic

  1. Double clicking the .reg file will not work, when saved from a normal text editor, as more recent Windows versions only ‘accept’ binary .reg files.

    Any possibility to have a binary version attached to this thread as well, because adding the file requires some registry skills beyond most of the regular users.

    rob

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 )

Google photo

You are commenting using your Google 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