Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old-style exceptions hang Pyblish QML #317

Open
BigRoy opened this issue Jan 21, 2019 · 2 comments
Open

Old-style exceptions hang Pyblish QML #317

BigRoy opened this issue Jan 21, 2019 · 2 comments
Labels

Comments

@BigRoy
Copy link
Member

BigRoy commented Jan 21, 2019

Issue

In Houdini we noticed that sometimes when a Houdini error was raised (that wasn't explicitly captured) in our plug-in that it would completely hang Pyblish QML. We found out that it was due to hou.Error not inheriting from the Python Exception and this code would not capture accordingly.

See this reproducible code snippet that also hangs outside of Houdini:

import pyblish.api

class RaiseOldStyleExceptionPlugin(pyblish.api.InstancePlugin):

    order = pyblish.api.ValidatorOrder
    label = "Raise Python 2 old-style exception"

    def process(self, instance):

        # define old style error
        class MyError:
            pass

        # this will hang Pyblish-QML indefinitely
        raise MyError

Solution

Adding a bare except would already solve it, but potentially we should still ignore KeyInterupt, etc. so we should set up a clever capture that at least ignores the ones we want to explicitly ignore.

So we'll need to do something like:

try:
    ...
except (KeyboardInterrupt, SystemExit, GeneratorExit):
    # Continue to raise these errors explicitly
    raise
except as error:
    # Capture any other error
@mottosso mottosso added the bug label Feb 22, 2019
@mottosso
Copy link
Member

Is this still a problem?

Looking a little closer, it looks like the issue may stem from here, where Exception and all of its subclasses are caught.

except as error:

Didn't know that was possible, but that would probably take care of it; it's the same same effect anyway, the only reason Exception is there is due to Flake8/PyLint warnings.

@BigRoy
Copy link
Member Author

BigRoy commented Feb 23, 2019

Yes, I believe it is still an issue. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants