1

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. #"

Falxo
  • 13
  • 5

1 Answers1

1

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()
DrWeeny
  • 2,487
  • 1
  • 14
  • 17
  • I'm using Maya 2019. I started noticing the issue when I tried to use a tool called "PyFlow". The repository had a Maya launcher so I decided to try it. That's when I got the Type error and then started noticing it on other Py-based tools in Maya. I'm going to add to the original post the script that gives this sort of error as an example. Again, the issue didn't start when I started using said tool, but it just made me realise that other Py-Tools were having the same issue all the sudden. – Falxo Mar 12 '20 at 19:59
  • it is using Qt module, are you using Qt module in all your scripts ? It might be indeed some kind of bad mix between PyQt5 and PySide2 parenting widget to maya window – DrWeeny Mar 12 '20 at 21:11
  • Also I see you did put a ticket, did you try shiboke2 on Mac, building a small ui ? – DrWeeny Mar 12 '20 at 21:19
  • I have never made anything that required me to use Qt, PySide or Shiboken before. I'm still learning so I never made anything with a UI at all before. I tried removing PyQt5 packages with `pip uninstall PyQt5`, but that didn't help. The conflict persists. Also, sorry, not sure what you mean by "ticket". – Falxo Mar 12 '20 at 22:23
  • in order to parent PySide or PyQt to maya window, two different module are used : sip for PyQt, shiboken with PySide. Qt is a wrapper by Marcus Ottosson that try to solve PySide, PyQt4, PySide2, PyQt5, by default it is supposed to use PySide2. Maybe somewhere in one script, you have a conflict between PyQt5, PySide2 and Qt parenting a window. You need to find any shiboken2 or sip2 in your scripts because a ui is fed with a non-shiboken object – DrWeeny Mar 12 '20 at 22:29
  • https://stackoverflow.com/questions/31117393/you-need-a-shiboken-based-type – DrWeeny Mar 12 '20 at 22:37
  • Sorry, but by the time I saw your edit it was too late. I did a `pip freeze | xargs pip uninstall -y` to bleach all packages, clean everything up, and start reinstalling only the necessary modules. That fixed everything, but I regret not having the time for doing it incrementally so I can find the guilty package and warn others who might be reading. The remaining suspects were: 1-_appdirs_ 2-_nose_ 3-_ply_ 4-_Pyomo_ 5-_PyUtilib_ 6-_six_. One of these packages was causing the conflict. – Falxo Mar 13 '20 at 00:08