Looks like in you are importing the wrong module, for the version of Maya
you are using.
you need to import PySide2, like you do in your code snippet. In one of
your modules you are importing PySide.
a good rule of thumb is to implement a try, where you try import pyside2,
and then if that fails import pyside1
try:
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2 import __version__
from shiboken2 import wrapInstance
except ImportError:
from PySide.QtCore import *
from PySide.QtGui import *
from PySide import __version__
from shiboken import wrapInstance
On Wednesday, 18 October 2017 11:10:33 UTC+11, jettam wrote:
>
>
> I am learning how to load a UI with pyside_dynamic. The problem is the
> tutorials where written for earlier version of Maya. (I am using maya2017)
>
> Here is the code I have been instructed to write. The error is this: "No
> module named PySide.QtCore" What should I write instead ?
> I read a blog that said "Maya 2017
> <http://www.autodesk.com/products/maya/overview> was released today and
> with it comes a big change; PySide (and PyQt4) no longer works with Maya."
>
> # Error: No module named PySide.QtCore
> # Traceback (most recent call last):
> # File "<maya console>", line 1, in <module>
> # File "E:\ProfessionalDevelopment\python\Introduction to Python
> Scripting in Maya\cgcircuitPython\wk6\geomGenerator_pysideDynamic.py", line
> 6, in <module>
> # import pyside_dynamic2
> # File "C:/Users/justin/Documents/maya/2017/scripts\pyside_dynamic2.py",
> line 42, in <module>
> # from PySide.QtCore import Slot, QMetaObject
> # ImportError: No module named PySide.QtCore #
>
>
> import os
> from PySide2 import QtWidgets, QtCore, QtUiTools, QtGui
> from shiboken2 import wrapInstance
>
> import pyside_dynamic2
>
> import maya.cmds as mc
> import maya.OpenMayaUI as omui
>
> def getMayaWindow():
> ''' pointer to the maya main window '''
> ptr = omui.MQtUtil.mainWindow()
> if ptr:
> return wrapInstance(long(ptr), QtWidgets.QMainWindow)
>
> def run():
> ''' builds our UI '''
> global win
> win = GeometryGenerator(parent=getMayaWindow())
> win.show()
>
> uiFilePath = os.path.join( os.path.dirname(__file__) ,
> 'geomGenerator_v001.ui')
>
> class GeometryGenerator(QtWidgets.QDialog):
>
> def __init__(self,parent=None):
> super(GeometryGenerator,self).__init__(parent)
> self.ui = pyside_dynamic2.loadUi(uiFilePath,self)
>
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/8ac211f5-a888-41e5-a2dc-442584871c29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.