jettam
2017-10-17 04:39:11 UTC
When I run this code I get this error. Could someone help me figure this
error out.
Its part of a video tutorial series that explains how to load UI's
# Error: name '__file__' is not defined
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# NameError: name '__file__' is not defined #
import os
from PySide2 import QtWidgets, QtCore, QtUiTools, QtGui
from shiboken2 import wrapInstance
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()
class GeometryGenerator(QtWidgets.QDialog):
def __init__(self,parent=None):
super(GeometryGenerator,self).__init__(parent)
loader = QtUiTools.QUiLoader()
currentDir = os.path.dirname(__file__)
print("currentDir: {0}".format(currentDir))
currentDir = os.path.dirname(__file__)
print("currentDir: {0}".format(currentDir))
error out.
Its part of a video tutorial series that explains how to load UI's
# Error: name '__file__' is not defined
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# NameError: name '__file__' is not defined #
import os
from PySide2 import QtWidgets, QtCore, QtUiTools, QtGui
from shiboken2 import wrapInstance
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()
class GeometryGenerator(QtWidgets.QDialog):
def __init__(self,parent=None):
super(GeometryGenerator,self).__init__(parent)
loader = QtUiTools.QUiLoader()
currentDir = os.path.dirname(__file__)
print("currentDir: {0}".format(currentDir))
currentDir = os.path.dirname(__file__)
print("currentDir: {0}".format(currentDir))
--
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 python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/18922585-840e-4ad7-ba40-9a695cd8d4af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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 python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/18922585-840e-4ad7-ba40-9a695cd8d4af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.