Error compiling .py with pyinstaller

0

Hi, I am trying to compile a .py file with pyinstaller (previously probe with py2exe as well) using the console command: "pyinstaller.exe --onefile --windowed name.py" and when the process finishes, the corresponding .exe file is generated, but upon opening it it displays the error message "failed to execute script name".
If I check the process that has been done in the command prompt console I can see a series of warnings like those in the attached image .
On the other hand, in the build folder that generates the compilation process I have a file called warning.txt with the following errors .
Where is my error? Thanks for your help.

    
asked by Ivan 20.12.2017 в 17:55
source

1 answer

0

There is a bug of pyinstaller that tries to import pointers of C , this is identified as a false positive, because although they are not imported directly, the API of the system in which the program is used is used. run, you can fix it by installing the C ++ distribution package for computers older than windows 10, but it's a minor problem

Regarding your execution problem, you should check / do the following:

  • Create a SPEC file for the program nombre.py
  • Verify that the selected options match the file SPEC
  • Verify which modules are written in python and which have links binaries to libraries in C
  • Add the binaries found to the SPEC file so that the package inside the directory
  • Verify that all third-party libraries are added either to the SPEC file or to the main execution file, that is, if nombre.py imports a file within the same directory: Nombre2.py and inside this one a library is imported that does not appear inside nombre.py , this library may not be imported and is what you cause the errors

once the program has been compiled into a directory, verify that everything works correctly, if it fails, make manual fixes, list them and try to add them either to the SPEC file, or to the name.py so that the next time you are looking to compile your project, it will run without problems,

a tip, try to use a distribution directory, it will cause you less problems and accelerate the loading of the program, to improve your development times, try to use the launcher model, to only compile once a launcher that calls the function main of nombre.py and that it imports the necessary libraries. so every time you change nombre.py , you will notice the change immediately.

once you have everything running, you can decide between leaving the launcher model or passing everything to a single file.

    
answered by 09.06.2018 в 23:39