So, when I run fbs run
the app runs perfectly. However, once I run fbs freeze
and open the created .exe file the windows command prompt opens, does some stuff then closes (I am not able to retrieve the log). This happens with the app installed through the installer generated with fbs installer
aswell. Running fbs freeze --debug
will not show anything strange.
My app is supposed to open chrome through the chromewebdriver and a GUI window created with PyQt5.
I run python 3.6.7 and have the correct PyQt5 version (5.9.2).
Edit It appeares that browser = webdriver.Chrome("src/main/resources/windows/chromedriver") is causing the problem. I store chromedriver.exe in src/main/resources/windows/
Here is my code:
from fbs_runtime.application_context.PyQt5 import ApplicationContext
from PyQt5.QtWidgets import QMainWindow, QWidget, QLayout,QGridLayout, QLabel, QTabWidget, QSizePolicy
from PyQt5 import QtCore
from selenium import webdriver
browser = webdriver.Chrome("src/main/resources/windows/chromedriver")
class MainWindow(QMainWindow):
allItems = {"type":[], "name":[], "size":[], "colour":[]}
def __init__(self, parent = None):
super(MainWindow, self).__init__(parent)
self.main_widget = QTabWidget(self)
self.main_widget.setSizePolicy(QSizePolicy.Preferred,
QSizePolicy.Ignored)
#Main Window
self.itemWidget = QWidget(self)
self.main_layout = QGridLayout(self.itemWidget)
self.main_layout.sizeConstraint = QLayout.SetDefaultConstraint
nameLabel = QLabel("Name")
self.main_layout.addWidget(nameLabel, 0, 0)
self.nameInput = QLineEdit()
self.main_layout.addWidget(self.nameInput, 0, 1)
self.main_widget.addTab(self.itemWidget, "Main")
self.setCentralWidget(self.main_widget)
if __name__ == '__main__':
appctxt = ApplicationContext()
window = MainWindow() #QMainWindow object
window.resize(600, 300)
window.show()
exit_code = appctxt.app.exec_()
sys.exit(exit_code)
Let me know if you need more details.
Did some of you have any idea about what could cause this?
Okay, I fixed my "bug". It turns out that ApplicationContext.get_resource()
does not access the resource file situated at src\main\resources but accesses src\main\resources\base. Knowing this I was able to organize my project keeping this in mind. I hope this can help someone later.