Right now, the Deadline slave process is hiding, truncating, and otherwise obfuscating Python exceptions to a degree that is very frustrating to someone trying to write code for it. Python’s succinct, informative traceback output is replaced with a single (inaccurate, in this case) exception message, and a lot of useless internal exception information. Consider this example:
I have an external module that needs to be imported. When said module is imported by the plugin’s module, I get this exception:
RenderPluginException -- Error in StartJob: GetDeadlinePluginWithJob: Python Error: ImportError : No module named deadline (Python.Runtime.PythonException)
Stack Trace:
[' File "none", line 12, in GetDeadlinePluginWithJob\n']
(System.Exception)
at FranticX.Scripting.PythonNetScriptEngine.HandlePythonError (System.Exception e) [0x00000] in <filename unknown>:0
at FranticX.Scripting.PythonNetScriptEngine.CallFunction (System.String functionName, Python.Runtime.PyObject[] args) [0x00000] in <filename unknown>:0
at Deadline.Scripting.DeadlineScriptEngine.CallFunction (System.String functionName, Python.Runtime.PyObject[] args) [0x00000] in <filename unknown>:0
at Deadline.Scripting.DeadlineScriptManager.CallFunction (System.String scopeName, System.String functionName, Python.Runtime.PyObject[] args) [0x00000] in <filename unknown>:0
at Deadline.Plugins.ScriptPlugin.InitializeLocalPlugin (Deadline.Jobs.Job job) [0x00000] in <filename unknown>:0
at Deadline.Plugins.ScriptPlugin.InitializeLocalPlugin (Deadline.Jobs.Job job) [0x00000] in <filename unknown>:0
at Deadline.Plugins.ScriptPlugin.StartJob (Deadline.Jobs.Job job, System.String& outMessage, FranticX.Processes.AbortLevel& abortLevel) [0x00000] in <filename unknown>:0
OK, I immediately see something I recognize: “ImportError : No module named deadline”. But this is impossible, since I had previously added a hard-coded call to sys.path.append with the correct module location immediately before my import statement.
After spending 30 minutes combing over all of my code making sure that what Deadline is seeing is as air-tight as possible, I wrap the import statement in my own try-except block, and print out the real exception… and the problem is something completely different than what Deadline told me:
0: PYTHON: Traceback (most recent call last):
0: PYTHON: File "none", line 13, in GetDeadlinePluginWithJob
0: PYTHON: File "/.../python/packages/deadline/plugins.py", line 12, in <module>
0: PYTHON: import luma.render.constants as renderconst
0: PYTHON: File "/.../python/packages/luma/__init__.py", line 86, in <module>
0: PYTHON: from luma.helpers import *
0: PYTHON: File "/.../python/packages/luma/helpers.py", line 14, in <module>
0: PYTHON: import pylib
0: PYTHON: File "/.../python/packages/pylib.py", line 1421, in <module>
0: PYTHON: import ordereddict
0: PYTHON: ImportError: No module named ordereddict
Now, I’m posting this somewhat frustrated after burning half an hour second-guessing myself for no reason, but I have two requests:
- Can we please can get a nice, clean Python traceback printed out when something goes wrong in Deadline’s Python environment?
- Can the internal .NET stack stuff either be cleaned up or completely separated from the Python exception information in the log? Or better yet, can it be completely disabled for Python exceptions?
Thanks