Skip to content

Conversation

@quitinit
Copy link

@quitinit quitinit commented Apr 8, 2025

The Problem

I encountered the issue that setting breakpoints in discovered plugins does not trigger that breakpoint. If the plugin has been registered manually, it will, but using pyblish.api.discover() it will go past the breakpoint in the plugin

How to reproduce the problem

I have created a seperate repository with a small example. Essentially, you set a breakpoint inside a plugin that has been added to the plugin_path before. When running it in vscode with the provided .vscode settings, it should trigger a breakpoint. However it does not.

The reason for the bug

The import mechanism is not quite correct in the discover method.
In plugin.py we use six.exec_ on a raw bytestream. This does import the plugin, however, for each object inside the module, python typically generates a code method. When using the normal import statement, python compiles the code before running exec on it. Crucially, with that compile step it associates the code method with a file. When the code then triggers a breakpoint, the debugger knows in which file it does so and can halt the execution. With the current approach there is no file associated. I attached two screenshots

image
how it is right. now
image
how it should be

My research on this topic is backed by this article

@quitinit
Copy link
Author

quitinit commented Apr 8, 2025

I noticed that the CI is failing for python 2 and python <3.5. Thank god it is there, I will do some adjustments later on to fix it

@quitinit
Copy link
Author

closes #405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant