Pyblish Maya : Possible to display multiple error messages from 1 validator?

I have a model validator to check the naming convention of nodes in a model hierarchy
(top parent node, child model node, child lod node etc).

Currently I am using assert to check each node name.
However, the actual user experience is :
run validation, see error, fix node name
run validation again, see next error, fix node name
repeat this process until all node name errors are fixed

This is inefficient and not a good user experience.
When there are multiple nodes with incorrect names,
I would like to display all the node name errors once.

Is this possble to do in a single validator ?
Currently, the validator will stop after hitting the first assert.
I have tried passing a list of error messages to raise ValueError(error_list) but it doesnt work well.

Please let me know if there is a way to do this.

Hi @virtualengineer,

Have you considered passing a multi-line string as an error?

errors = list()

for node in
  if "somethingWrong" in node:
    errors += ["- %s is wrong" % node]

assert not errors, "\n".join(errors)

Hi @marcus,

Thanks for the reply.

First, I should mention I am using the pyblish lite gui.

Although I did test out the above suggested code, it did not work.

Pyblish lite doesn’t seem to be able to handle multi-line error strings.

I think Pyblish qml is able to display it ok though.

However, due to qt licensing issues, I must use Pyblish lite.

See attached image for reference.


In that case, I think think of a few options.

  1. Prior to raising an error (and stopping the publish), log errors; they’ll appear in red as well just above the last exception.
  2. Middle-click-hold on the error message to display the full thing
  3. Have a look at what these guys are doing with Lite.

For completeness and future readers, both Qt, Pyblish, Lite and QML fall under the same licensing, GPL and LGPL.

Thanks for the quick reply.
The information you posted is very helpful.

1 Like