Python binary file is very slow in execution

Hi all, 

I have written a script on Anaplan connectivity through python.
Now I have converted that python script (.py) file to binary (.exe) file with the help of pyinstaller and --onefile

 

But on launching that '.exe' file, its taking too much time approximately 10 minutes or more than that.

Any suggestion please...


 

Answers

  • Hi @pankajnegi1920,

     

    First of all, that's probably not Anaplan topic, rather Python and PyInstaller. Try searching for the answer in their documentation or forums, like here: https://pyinstaller.org/en/stable/operating-mode.html#how-the-one-file-program-works

     

    My best guess: as you are using --onefile, as the first step .exe has to unpack and compile all libraries included in the script to a temp directory, before the main logic of the app can start. In your case, maybe you have included a lot of libraries, or these libraries are quite large, and it takes few seconds for them to decompress and load (indicator of this problem can be that your .exe file weights a lot). Can you try reducing number or size of libraries you use (so avoid big, unnecessary packages, which is a good practice anyway), or try using the one directory mode?