The window.ui with form conveted converted to window.py error in PySide2.QtWidgets.QTabWidget(MyWindow)

跟風遠走 提交于 2021-01-29 20:13:03

问题


I create a window

CREATE USERS

and in the Python code I did:

def __init__(self):
    try:
        super(QDialog, self).__init__()
        super(MyWindow, self).__init__()
        self.ui = uic.loadUi('CreateUsers.ui', self)

You can show that I used "CreateUsers.ui" file, but I used pyside2-uic CreateUsers.ui > ui_create_user.py and tried to use with this way:

def __init__(self):
    try:
        super(QDialog, self).__init__()
        super(MyWindow, self).__init__()
        #self.ui = uic.loadUi('CreateUsers.ui', self)
        self.ui = Ui_Form()
        self.ui.setupUi(self)

I converted this all in EXE used pyinstaller, but when I try to use appear a error in PySide2 with these messages:

FIXME Subscripted generics cannot be used with class and instance checks
Erro na tela inicial: 'PySide2.QtWidgets.QTabWidget' called with wrong argument types:
  PySide2.QtWidgets.QTabWidget(MyWindow)
Supported signatures:
  PySide2.QtWidgets.QTabWidget(typing.Union[PySide2.QtWidgets.QWidget, NoneType] = None)

The window appeared empty too

Empty Window here

This application I created in python to manage SAP users create. This application load all sap users, load from ProcessMaker a list of users that will be create and we use this tool(AutoSAP) to with one button and others to check if ok, we create users in SAP.

Please, somebody has an idea with I solve this issue?


回答1:


CreateUsers.ui is missing on pyinstaller bundled binaries. pass CreateUsers.ui in datas argment or use a spec file as above to provide missing CreateUsers.ui

before trying the pyinstaller again you may copy CreateUsers.ui to pyinstaller output folder to test

block_cipher = None
a = Analysis(['minimal.py'],
     pathex=['/Developer/PItests/minimal'],
     binaries=None,
     datas=None,
     hiddenimports=[],
     hookspath=None,
     runtime_hooks=None,
     excludes=None,
     cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
     cipher=block_cipher)
exe = EXE(pyz,... )
coll = COLLECT(...)

datas: non-binary files included in the app, including names given by the --add-data option.

pyinstaller reference



来源:https://stackoverflow.com/questions/61479868/the-window-ui-with-form-conveted-converted-to-window-py-error-in-pyside2-qtwidge

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!