Falxo
Falxo

Reputation: 13

Maya Python - "You need a shiboken-based type" Error

Many Python based tools in Maya are now returning an error that is new to me. "You need a shiboken-based type. #"

Very fresh to Python, so I don't really know what the issue is. After looking around a bit a figured out it's maybe a conflict of definitions

The "QtGui" module is probably being imported more than one times, creating said conflict. Not entirely sure that's the main cause, but it's the main suspect for now.

Now to be honest, I have just now started noticing that some of Maya's Python tools are not functioning because of this (like the "Type" creation tool), meaning that I have installed/uninstalled several python packages using pip before coming across the issue. I have no clue which package could be causing the conflict.

Are there any usual suspects that can cause this conflict? I tried uninstalling some of the more recent packages but with no luck.

I also wouldn't want to damage anything else by individually removing packages until I find it.

These are the packages installed:

• aenum 2.2.3
• altgraph 0.10.2
• appdirs 1.4.3
• bdist-mpkg 0.5.0
• blinker 1.4
• bonjour-py 0.3
• docutils 0.16
• macholib 1.5.1
• matplotlib 1.3.1
• modulegraph 0.10.4
• nine 1.1.0
• nose 1.3.7
• numpy 1.8.0rc1
• pip 20.0.2
• ply 3.11
• ptvsd 4.3.2
• py2app 0.7.3
• PyFlow 2.0.1
• pyobjc-core 2.5.1
• pyobjc-framework-Accounts 2.5.1
• pyobjc-framework-AddressBook 2.5.1
• pyobjc-framework-AppleScriptKit 2.5.1
• pyobjc-framework-AppleScriptObjC 2.5.1
• pyobjc-framework-Automator 2.5.1
• pyobjc-framework-CFNetwork 2.5.1
• pyobjc-framework-Cocoa 2.5.1
• pyobjc-framework-Collaboration 2.5.1
• pyobjc-framework-CoreData 2.5.1
• pyobjc-framework-CoreLocation 2.5.1
• pyobjc-framework-CoreText 2.5.1
• pyobjc-framework-DictionaryServices 2.5.1
• pyobjc-framework-EventKit 2.5.1
• pyobjc-framework-ExceptionHandling 2.5.1
• pyobjc-framework-FSEvents 2.5.1
• pyobjc-framework-InputMethodKit 2.5.1
• pyobjc-framework-InstallerPlugins 2.5.1
• pyobjc-framework-InstantMessage 2.5.1
• pyobjc-framework-LatentSemanticMapping 2.5.1
• pyobjc-framework-LaunchServices 2.5.1
• pyobjc-framework-Message 2.5.1
• pyobjc-framework-OpenDirectory 2.5.1
• pyobjc-framework-PreferencePanes 2.5.1
• pyobjc-framework-PubSub 2.5.1
• pyobjc-framework-QTKit 2.5.1
• pyobjc-framework-Quartz 2.5.1
• pyobjc-framework-ScreenSaver 2.5.1
• pyobjc-framework-ScriptingBridge 2.5.1
• pyobjc-framework-SearchKit 2.5.1
• pyobjc-framework-ServiceManagement 2.5.1
• pyobjc-framework-Social 2.5.1
• pyobjc-framework-SyncServices 2.5.1
• pyobjc-framework-SystemConfiguration 2.5.1
• pyobjc-framework-WebKit 2.5.1
• Pyomo 5.6.8
• pyOpenSSL 0.13.1
• pyparsing 2.0.1
• PyQt5 5.14.1
• PyQt5-sip 12.7.1
• PySide2 5.14.1
• python-dateutil 1.5
• pytz 2013.7
• PyUtilib 5.7.3
• Qt.py 1.2.4
• qtwidgets 0.11
• scipy 0.13.0b1
• setuptools 18.5
• setuptools 28.8.0
• shiboken2 5.14.1
• six 1.14.0
• six 1.4.1
• vboxapi 1.0
• xattr 0.6.4
• zope.interface 4.1.1

Any help would be greatly appreciated.

EDIT - 12/3/2020 20:30

As an example for when this error occurs, I'm also including this script from PyFlow:

import ptvsd
from maya import OpenMayaUI as omui
from shiboken2 import wrapInstance
from PyFlow.App import PyFlow
from PySide2.QtWidgets import QWidget

try:
    long  # Python 2
except NameError:
    long = int  # Python 3path

ptvsd.enable_attach(address=('0.0.0.0', 3000), redirect_output=True)

mayaMainWindowPtr = omui.MQtUtil.mainWindow()
mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), QWidget)

if PyFlow.appInstance is None:
    instance = PyFlow.instance(mayaMainWindow, "maya")
    instance.show()

"PyFlow" is a promising little tool for visual scripting, which is great for novices like myself. The issues didn't start when I first ran it, but it helped me notice the error that many other python-based tools in Maya were giving now as well.

If I attempt to run this for example:

"# Error: TypeError: file line 15: You need a shiboken-based type. #"

Upvotes: 1

Views: 1908

Answers (1)

DrWeeny
DrWeeny

Reputation: 2512

have you an example of script that import QT ui. Which version of maya are you using also ?

are all your imports look like this :

from PySide2 import QtWidgets, QtGui, QtCore
import shiboken2

have you maybe mix PyQt and PySide with some "import sip2"

---EDIT---

from maya import OpenMayaUI as omui
from shiboken2 import wrapInstance
from PyFlow.App import PyFlow
import PySide2.QtWidgets as QtWidgets

mayaMainWindowPtr = omui.MQtUtil.mainWindow()
mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), QtWidgets.QWidget)

if PyFlow.appInstance is None:
    instance = PyFlow().instance(mayaMainWindow, 'maya')
    instance.show()

Upvotes: 1

Related Questions