Fix Exception AttributeError when using pyside