No hook files generated by PyInstaller - hook

In the PyInstaller documentation the following is stated:
The name of a hook file is hook-full.import.name.py, where
full.import.name is the fully-qualified name of an imported script or
module. You can browse through the existing hooks in the hooks folder
of the PyInstaller distribution folder and see the names of the
packages for which hooks have been written.
However in my current attempt to generate an executable for my script, after running I see that there is no hooks folder in the dist folder generated.
Am I looking in the wrong folder? Where are my hook files being dumped?

The docs state
You can browse through the existing hooks in the hooks folder of the
PyInstaller distribution folder
and not
You can browse through the existing hooks in the hooks folder of the
distribution folder
Which means that you cannot expect to find the hooks in the dist folder generated by running
pyinstaller test.py
You must find them, for the anaconda case, in:
Anaconda\Lib\site-packages\PyInstaller\hooks
For other environments you can also check in the site-packages directory

Related

Moving Git to another folder, but I've got a problem

My git was init in folder ~/ryan/pythonproject/ and then later on I started using PyCharm and it created a venv for the project after importing. So now I have:
~/ryan/pythonproject/venv/
The first directory has my original work on the project, and then it appears I have a duplicate of my work under the venv folder.
Whenever I commit/add/push it does the original folder as well as the venv folder.
What I would like to do is have Git stop monitoring the original folder and only have git under the venv folder only. What's the best way to do that?
If you want to stop monitoring a folder you can put it to the .gitignore file. So i.e. you have:
YourProject/venv/FolderA
YourProject/venv/FolderB
YourProject/FolderA
YourProject/FolderB
Then just add the lower two to the .gitignore .
But please think about it whether this is really what you want. Usually it is the other way around. Keep your files and ignore the build folder.

Hide input files during the conversion of python scripts into exe

I have python scripts in folder A and some dependent input files (.xlsx,.txt) in folder B.
I am using cx_Freeze to convert them into exe.
I have the files in the folder B as a list in include_files in setup.py
During the conversion, the files fall in the build folder.
The files should not be visible to the user, or at least they should be only in read-only mode.
You can use os.chmod at the end of your setup script to make any file of the build directory read-only. For example:
import os
import stat
os.chmod(path_to_file, stat.S_IREAD)
Of course you need to know the path to the build directory. You can also tell cx_Freeze which directory to use as build directory by using the build_exe option of the build_execommand, see the cx_Freeze documentation.

How to include all necessary files and folders in python executable file using pyinstaller on ubuntu?

I want to keep all the python script files hidden and want to give executable file to the user.
Here's the screeenshot of the folder:
I am running it from the webroot directory of a project.I am going to run my project on the local host. In the Al3ViewerController I have given path to the main.py/ exe main file using shell_exec. But I need to keep the folder containing all the other python and DB files and I cannot do that for code security purpose, hence an exe file to run. could be --onefile / folder. I would want to remove that folder completely and just run from the executable file

Making an Executable out of an entire Python Project

Is there any way I can make an executable out of my Python project? There are many Python scripts that are in my Project and there are SQLite db files as well as other files and folders that are required for the software to run correctly. What is the best way of making this entire project executable?, Should I only make the Python scripts executable?
I have tried Pyinstaller but I am not sure how to bundle all the files into 1 single executable. Shown above is a copy of all the files and folders in my directory.
I think you need to modify the spec file, which PyInstaller creates on a first run. There is a special parameter for data files:
binaries: non-python modules needed by the scripts, including names given by the --add-binary option;
Try adding your database and other data files to this field and they should be included to you package.
For further question I recommend to refer to official documentation and check examples on Github

no such file or directory (cygwin)

I am trying to install a solver (SCIP) with cygwin. After unpacking the folder consists of another 5 folders. The manual says I have to go in folder A and use make. Here, I get the message that one file was not found:
zimpl/bool.h: No such file or directory
This file is in folder B in the path zimpl/src/bool.h. How can I link this file from folder B that cygwin can use it while using make in folder A?
The support says:
Blockquote The error you postet looks like your zimpl softlink is incorrect. If you use a relative path, make sure that it is relative to the position where
the link is created. Most softlinks are created directly in the lib
directory, the zimpl softlink, however, is in a subdirectory of the lib
directory, so you have to go up two directories to get to the main SCIP
directory.
However I am not sure how to check the softlinks.
Thanks!

Resources