Debugging Plugins

Hey again. Been enjoying my time with pyblish, I’ve got the hang of it enough to be able to turn around new publish functionality pretty quickly. I’ve been bringing a few new users up to speed and wanted to share a bit of their feedback.

The main thing is that debugging has been time consuming for those who are still learning the system. We’re using the pyblish-lite UI, and when things error, it doesn’t seem to provide a full stack trace, so it can be a bit of work to determine where exactly things are failing. Especially if an end user reports an error, since you can’t copy/paste from the UI. I’d like for the integrated logger to log to a file, I assume that would be pretty easy to do but wondering if anyone has set that up already or if there’s a preferred method.

Another request has been that the comment in the UI remember it’s value when you refresh. Currently if you try to publish and a validator fails, you lose your comment. Would be nice if it stayed, the same way the checkboxes are persistent for instances and plugins.

I agree that the debugging experience can be trickier in pyblish-lite than in pyblish-qml. Although I think it boils down to these two issues; https://github.com/pyblish/pyblish-lite/issues/36 and https://github.com/pyblish/pyblish-lite/issues/32

Especially if an end user reports an error, since you can’t copy/paste from the UI

We were talking about this for pyblish-qml, and it would probably be easy to implement for pyblish-lite; https://github.com/pyblish/pyblish-qml/issues/107

Thanks for this @morganloomis! Very valuable feedback.

Have a look at how pyblish-qml deals with the issue of error information, in particular how it appears in the terminal and perspective view, and see if it’s what you’re looking for in pyblish-lite. Then we’d have something tangible to look at and contrast with. Attaching references below.

Remembering the comment should be a no-brainer. Have a look at how it remembers checkstate and try to extrapolate how this could look for the comment.


Perspective

Terminal


Man qml looks so much nicer. I might try to push for updating qt again so we can just use that.

Any hints on how you would set the internal logger to log to a file? My first attempt was just setting logger.basicConfig, but I don’t have a lot of experience with custom loggers yet.

And it didn’t work adding a file handler? http://stackoverflow.com/questions/6386698/using-the-logging-python-class-to-write-to-a-file

You would have to setup this up in all hosts on startup.

Hey @morganloomis,

When you say internal logger, which messages are you referring to? There are two main points of messages being produced.

  1. Messages produced by Pyblish functions, like api.discover()
  2. Messages produced by plug-ins, those made via self.log.info("my message")

For (1), have at Philip’s question here.

For (2), the messages in both util.py, pyblish-lite and pyblish-qml are coming from the result dictionary.

from pyblish import api, util

class MyPlugin(api.ContextPlugin):
    def process(self, context):
        self.log.info("my message")

api.register_plugin(MyCollector)
context = util.publish()

for result in context.data["results"]:
  for record in result["records"]:
    print(record.msg)

# my message
1 Like

About this, it doesn’t necessarily have to see an update company-wide. Just install Python 3.5, pip install PyQt5, and put it somewhere on the network where only pyblish-qml can see it. And you’re done.

pyblish-qml can be the sole user of these binaries, it doesn’t and shouldn’t affect any other applications.