Search code examples
pythonmayapymel

'exceptions.RuntimeError' - Object has no attribute 'errno'


I'm working with Maya 2018 and there's a weird thing going on. When I select multiple vertices, faces or edges I get:

// Error: AttributeError: file <string> line 88: 'exceptions.RuntimeError' object has no attribute 'errno' // 
// Warning: Python callback failed // 

The problem with this in what I'm scripting is that when this warning/error appears, somehow it does not let me click on my custom GUI buttons. For example. I need to select a few vertices then click a button to save them into a custom attribute... Well I can't click that button right away, and I'm guessing it is because of this weird error.

Any ideas on what this is?


Solution

  • In line 88 of your script you're trying to use attribute errno of RuntimeError instance but this exception class has no such attribute.
    Read documentation of exceptions before trying to handle them.

    Atrribute errno is defined only in OSError and classes inheriting from it.
    So apparently line 88 is part of try...except clause and in that line you're trying to use e.errno. You can't do that if the exception doesn't belong to OSError exceptions family.