AWS Thinkbox Discussion Forums

MayaPy Plugin Error Management

Hello,

We’ve implemented handling exceptions in Deadline for mayapy at work, but we want to make sure our implementation is a good idea (or if there’s a better idea).

The problem:
Maya sends out a ton of errors on file load that can make it hard for regexes to sort out the skippable errors from the ones we want to fail on. We can’t rely on checking if the process has exited because exceptions don’t usually cause mayapy to exit.

The solution:
We have added a small function that runs after every command submission to check if an error has happened. Its internals looks something like this:

if getattr(sys, "last_value", None):
    sys.stdout.write("--- DEADLINE MAYA ERROR --- {}: '{}'\n".format(sys.last_value.__class__.__name__, sys.last_value.message))

In other words, we check to see if sys.last_value has a value, and then print a magic string “— DEADLINE MAYA ERROR — ExceptionType: ‘Exception message’” that the ManagedProcess will listen for and error out the job if it finds it.

Does this make sense, or is there a better way that lets us communicate errors from the managed mayapy session to the plugin so we can track errors? Thanks for your time.

Privacy | Site terms | Cookie preferences