Python Forum

Full Version: Get a executable file (.exe) from a .py file add a promoted class in a QWidget
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!! guys,
I am trying to get a .exe file ready to be executed from a click of a button on a screen (QMainWindow). In fact, in the past I have done it without any issue.
In this case I am adding a chart plotter as a figure from library : matplotlib set a promoted class using a QWidget.

I have 3 files attached to run this chart plotter as a file .exe shown below:

    
def UI_GetChart(self): 
                #win32api.ShellExecute(0, "open", "C:\Python3_11\Lib\APT_ControlPanel\SC\SC002_GetChart_plotter.exe", None, ".", 0)
                #subprocess.run(["C:\Python3_11\Lib\APT_ControlPanel\SC\dist\SC002_GetChart_plotter.exe"])          
                os.system("C:\Python3_11\Lib\APT_ControlPanel\SC\SC002_GetChart_plotter.exe")
                self.key_getChart.setCheckable(False)
                self.key_getChart.setCheckable(True)
                pass    
Reply of the Traceback:

Error:
File "SC\SC002_GetChart_plotter.py", line 68, in <module> # window = GetChart_plotter() ^^^^^^^^^^^^^^^^^^ File "SC\SC002_GetChart_plotter.py", line 20, in __init__ loadUi("C:\\Python3_11\\Lib\\APT_ControlPanel\\Screens\\004_GetChart_plotter.ui",self) File "PyQt5\uic\__init__.py", line 241, in loadUi File "PyQt5\uic\Loader\loader.py", line 66, in loadUi File "PyQt5\uic\uiparser.py", line 1037, in parse File "PyQt5\uic\uiparser.py", line 828, in createUserInterface File "PyQt5\uic\uiparser.py", line 806, in traverseWidgetTree File "PyQt5\uic\uiparser.py", line 273, in createWidget File "PyQt5\uic\uiparser.py", line 806, in traverseWidgetTree File "PyQt5\uic\uiparser.py", line 264, in createWidget File "PyQt5\uic\uiparser.py", line 228, in setupObject File "PyQt5\uic\objcreator.py", line 100, in createQObject File "PyQt5\uic\objcreator.py", line 125, in findQObjectType File "PyQt5\uic\Loader\qobjectcreator.py", line 113, in search ModuleNotFoundError: No module named 'mplwidget' [2472] Failed to execute script 'SC002_GetChart_plotter' due to unhandled exception! PS C:\Python3_11\Lib\APT_ControlPanel>
Any recommendation for doing it correctly Shocked