Hope you doing well guys! I am starting a project using PyCharm and also a Virtual Env. Can someone help please? I have these file:
main.py with the code:
from fbs_runtime.application_context.PySide2 import ApplicationContext
import sys
from package.main_window import MainWindow
if __name__ == '__main__':
appctxt = ApplicationContext() # 1. Instantiate ApplicationContext
window = MainWindow()
window.resize(250, 150)
window.show()
exit_code = appctxt.app.exec_() # 2. Invoke appctxt.app.exec_()
sys.exit(exit_code)
I have another file main_window.py with these code: from PySide2 import QtWidgets
class MainWindow(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.setup_ui()
def setup_ui(self):
self.create_widgets()
self.modify_widgets()
self.create_layouts()
self.add_widgets_to_layouts()
self.setup_connections()
def create_widgets(self):
self.btn_click = QtWidgets.QPushButton("Click")
def modify_widgets(self):
pass
def create_layouts(self):
self.main_layout = QtWidgets.QVBoxLayout(self)
def add_widgets_to_layouts(self):
self.main_layout.addWidget(self.btn_click)
def setup_connections(self):
self.btn_click.clicked.connect(self.bouton_clicked)
def bouton_clicked(self):
message_box = QtWidgets.QMessageBox()
message_box.setWindowTitle("Bravo")
message_box.setText("Première application réussi")
message_box.exec_()
Finally I have create a freeze.sh file with this: source ~/PycharmProjects/venv/Scripts/activate cd ~/PycharmProjects/echaufement/
fbs clean
fbs freeze
I cd my src/main folder and usig: sh freeze.sh it create a target folder containing my App.exe but when open my App.exe I have the following error: fail to execute script main Finally after debugging -fbs freeze --debug- and I have this - see image please Thank you for your help.
Is there some pathing issue with
./Scripts/fbs-script.py
line 11?Also as a general rule,
fbs
doesn't play well beyond python 3.6. Try freezing the app again when a python 3.6.x venv?I've outlined how to use a python 3.6.x
virtualenv
to buildfbs
app here: How to compile PyQt5 program that uses python 3.8