Maya2017\bin\python27.zip\xml\etree\ElementTree.py line 647: 2

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  05 May 2018
Maya2017\bin\python27.zip\xml\etree\ElementTree.py line 647: 2

Hey, guys. Looking how to solve the problem already for few days. Can somebody help , please?
I am trying to load ui file which was created in QtDesigner in Maya 2017 . Whenever I try to load ui :

from loadSkeletonCore import loadSkeleton
reload(loadSkeleton)
loadSkeleton.run_plugin()



I am getting this error :
Quote: # Error: IOError: file C:\Program Files\Autodesk\Maya2017\bin\python27.zip\xml\etree \ElementTree.py line 647: 2 #

I made few files in 'Documents\maya\2017\scripts\loadSkeletonCore' :

1.loadSkeleton.py
from pymel.core import *
import os
from loadSkeletonCore.loadUiFile import getMayaWindow, loadUiFile
import loadSkeletonCore.loadUiFile as stuff
reload(stuff)
uiFile = os.path.join(os.path.dirname(__file__), 'loadSkeletonCore', 'test.ui')
listForm, listBase = loadUiFile(uiFile)
class loadSkeletonUI(listForm,listBase):
def __init__(self, parent=getMayaWindow()):
self.windowName = 'RigaOrientJointMainWin'
if window(self.windowName,exists=True):
deleteUI(self.windowName)
super(loadSkeletonUI, self).__init__(parent)
self.setupUi(self)
def run_plugin():
ex = loadSkeletonUI()
ex.show()


2. loadUiFile.py
import maya.cmds as cmds
import zipfile
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2 import QtGui
from PySide2 import QtWidgets
from cStringIO import StringIO
import xml.etree.ElementTree as xml
import maya.OpenMayaUI as omui
try:
from shiboken import wrapInstance
import pysideuic
except:
from shiboken2 import wrapInstance
import pyside2uic as pysideuic
def getMayaWindow():
pointer = omui.MQtUtil.mainWindow()
if pointer is not None:
return wrapInstance(long(pointer), QtWidgets.QWidget)
def loadUiFile(uiFile):
parsed = xml.parse(uiFile)
widgetClass = parsed.find('widget').get('class')
fornClass = parsed.find('class').text
with open(uiFile, 'r') as f:
o = StringIO()
frame = {}

pysideuic.compileUi(f, o, indent=0)
pyc = compile(o.getvalue(), '<string>', 'exec')
exec pyc in frame

formClass = frame['Ui_{0}'.format(formClass)]
baseClass = eval('QtGui.{0}'.format(widgetClass))

return formClass, baseClass



3. test.ui - just simple test ui made in QtDesigner

Last edited by afosss : 05 May 2018 at 12:41 PM.
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:48 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.