Open BigRoy opened 5 years ago
Transferred this from pyblish-qml
to pyblish-base
. Here's the stack trace from pyblish-base
:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "D:\git_pipeline\avalon\development\git\pyblish-base\pyblish\util.py", line 193, in collect
for result in collect_iter(context, plugins, targets):
File "D:\git_pipeline\avalon\development\git\pyblish-base\pyblish\util.py", line 252, in collect_iter
context, plugins, targets):
File "D:\git_pipeline\avalon\development\git\pyblish-base\pyblish\util.py", line 300, in _convenience_iter
for result in publish_iter(context, plugins, targets):
File "D:\git_pipeline\avalon\development\git\pyblish-base\pyblish\util.py", line 119, in publish_iter
result = plugin.process(Plugin, context, instance)
File "D:\git_pipeline\avalon\development\git\pyblish-base\pyblish\plugin.py", line 460, in process
result = __explicit_process(plugin, context, instance, action)
File "D:\git_pipeline\avalon\development\git\pyblish-base\pyblish\plugin.py", line 479, in __explicit_process
raise AssertionError("Cannot process an InstancePlugin without an "
AssertionError: Cannot process an InstancePlugin without an instance. This is a bug
Tested with the above example plug-ins and running the following:
import pyblish.util
pyblish.util.collect()
moving your repro steps all in one block of code:
import pyblish.api
import pyblish.util
class Collector(pyblish.api.InstancePlugin):
order = pyblish.api.CollectorOrder
def process(self, context):
pass
pyblish.api.register_plugin(Collector)
pyblish.util.collect()
prints:
# Error: AssertionError: file C:\Projects\pyblish-base\pyblish\plugin.py line 490: Cannot process an InstancePlugin without an instance. This is a bug #
would simply changing
raise AssertionError("Cannot process an InstancePlugin without an ""instance. This is a bug." )
to
raise AssertionError("Cannot process an InstancePlugin without an ""instance. This is a bug. Affected plugin:" + str(plugin))
be enough to resolve this?
output for your example now tells you which plugin it fails on.
# Error: AssertionError: file C:\Projects\pyblish-base\pyblish\plugin.py line 491: Cannot process an InstancePlugin without an instance. This is a bug. Affected plugin:<class 'pyblish.plugin.Collector'>#
Issue
Whenever you implement a
pyblish.api.InstancePlugin
with aprocess
method that does not have the argumentinstance
but it's written differently/wrong then Pyblish QML will raise the following assertion error:For example, the following will reproduce this error:
Notice how the argument is
wrong
as opposed toinstance
.Similarly
context
fails on anInstancePlugin
too with the same error:Proposal
It would be great if the error would be resolved into a message describing which plug-in is faulty with some information for the developer on how to potentially resolve it.
Reference:
I've also tried to reproduce the other way around with
pyblish.api.ContextPlugin
but it doesn't run into the same issue, however does have an issue of its own which should be a separate issue than this, see pyblish/pyblish-qml#339.