'long" is not defined

'long" is not defined

moiamy
Collaborator Collaborator
3,431 Views
1 Reply
Message 1 of 2

'long" is not defined

moiamy
Collaborator
Collaborator

Hello

I am doing some experiment with Pyside and Maya 2022

 

I have followed this reference page from Autodesk

 

but I got a problem with this line :

 

 

 

widget = wrapInstance( long(ptr), QWidget)

 

 

 

 

Wich gives me ;

# Error: NameError: file <maya console> line 12: name 'long' is not defined #

 

And obvioulsy type of ptr is <class 'SwigPyObject'>

 

Here is the code

 

 

 

from maya import cmds
from maya import mel
from maya import OpenMayaUI as omui
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from shiboken2 import wrapInstance

omui.MQtUtil.mainWindow()
ptr = omui.MQtUtil.mainWindow()
print(type(ptr))
widget = wrapInstance( long(ptr), QWidget)

 

 

Where is the mistake ?

0 Likes
Accepted solutions (1)
3,432 Views
1 Reply
Reply (1)
Message 2 of 2

negow
Advocate
Advocate
Accepted solution

long has been renamed int in Python 3