简体   繁体   中英

Why does Pyinstaller exe open and close then open again?

I've compiled an app using python, js, html and css (using eel to link them). It's all working but when I load the exe that is compiled, it opens the app logo, bounces up and down (as apps do on Macs when loading) then the logo disappears, and then the app opens after about 8 seconds from google chrome.

Is this normal for Pyinstaller executables ie opening from chrome, or is there something in my code? If so, leave a comment and I will update this question with relevant snippets of my code!

Thanks

I've made a work around and am posting it as the answer to this question incase someone has a similar issue in the future.

After doing research I found that PyInstaller is simply just slow in most cases where there is a larger python file ie machine learning. There were also other issues with integrating PyInstaller and JS/HTML/CSS, where you have to use Eel to communicate between the documents, and subsequently, every desktop/web application you make will have to involve google chrome.

SOLUTION: As an alternative to building the desktop application via PyInstaller, I am building it using Blazor/Electron. There is no direct link between Blazor/Electron and Python, as Blazor relies on C#, JS/HTMLCS. Therefore, I ported in IronPython into my C# file, this allows me to communicate along the following path. C# -> Python -> C# -> JS/HTML/CSS. An additional advantage to Blazor/Electron is that the application can be built as a local desktop application without internet connection, and it boots up much faster. Lastly, C# allows for building Splash Screens (loading screen while the app boots up for the first time) for your application, so even if you're app is huge and it has a long load time, the user can be informed that the desktop app is loading!

is it possible that while compiling your app with Pyinstaller, you used --onefile ? If this is the case, try compiling again without this command and see if the problem still persists.

from the Pyinstaller docs:

... the single executable is a little slower to start up than the one-folder bundle.

Before you attempt to bundle to one file, make sure your app works correctly when bundled to one folder. It is is much easier to diagnose problems in one-folder mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM