Debugging in Maya with Stack Trace
Updated: May 21, 2021
Did you know that having this option enabled in your script editor will make your life a lot easier?
It might seem obvious to point this out. But if we all assume something is obvious and don't talk about it, how are less experienced game devs supposed to learn it? School doesn't teach you everything!
The Show Stack Trace option enables a feature in the script editor that gives you a more detailed error message. It shows you which line and/or functions the error happened.
1 def doSomething(a): 2 a += 1 3 print "\nI'm doing %s somethings" %a 4 5 doSomething(4)
If I run this, it correctly returns:
I'm doing 5 somethings
To demonstrate, I'm going to run doSomething("ohno") :
We can't add a string and an integer together, so Stack Trace tells me that when it tried to run the function doSomething() on line 5, it encountered an TypeError on line 2 (a += 1).
I hope this helps!