I’m using separate plugin files and registering the plugin path.
I noticed that if I made a mistake in one of plugin files (and I frequently do ), such as an import or syntax error, instead of pyblish warning me that it couldn’t load a plugin, or in some way notifying me, it silently ignores it. I appreciate that its perhaps not always desired to print a message or or notify the user, but for debugging it would be helpful.
Is there a way already that I can get it to validate\check\warn about non loaded plugins?
There are messages that you can enable, through the logging module. But I admit it isn’t very obvious and we haven’t spoken much about it.
They are produced as logging.DEBUG level messages and can be activated and customised like this.
import logging
import pyblish.api
# Step 0, this doesn't produce any warnings..
pyblish.api.discover()
# Step 1, bring out the debug level messages
logging.getLogger("pyblish").setLevel(logging.DEBUG)
# Step 2, unless there already is a handler, one must be setup.
logging.basicConfig()
# Step 3, done
pyblish.api.discover()
# DEBUG:pyblish.plugin:Skipped: "collect_myplugin" (name 'pybddlish' is not defined)
The handler can be customised to tailor the format and contents of the messages, like a timestamp and what not.
The idea is for Pyblish to not pollute the terminal. It was an early decision and should be coherent across all of the framework, they all produce developer-friendly messages under logging.DEBUG. Some hosts have a handler already installed, possibly Maya and Nuke, so step 2 might be skipped.
But it’s definitely up for discussion, we have a much better picture now of how many messages are actually produced and how necessary they are. At the very least it should be better documented, so thanks for bringing this up!
Edit: for reference, here is where this particular message is produced.