python-3.xpyinstallertrojanpython-bindingspython-exec

Pyinstaller adddata query


When I am trying to converting my python file into executable and binding with pdf with using command add-data. My pdf file is store no where due to this I cannot open my pdf file while opening executable.(yes, but command will create executable properly but there storing of pdf in default temp directory).

command:

pyinstaller.exe --add-data src;. --onefile python_file.py

P.s:- I tried to popen my file through my code but pdf is storing nowhere so, I cannot execute popen command


Solution

  • The documentation of pyinstaller is here: https://pyinstaller.readthedocs.io/en/stable/usage.html and syntax of this command is:

    --add-data <SRC;DEST or SRC:DEST>
        Additional non-binary files or folders to be added to the executable. The path 
    separator is platform specific, os.pathsep (which is ; on Windows and : on most unix 
    systems) is used. This option can be used multiple times.
    

    It means that for each folder of data you need use this parameter once. SRC is path in your system. DST is path relative to your bundle root. I suggest do not use --onefile when you have some problem with build. Then you can easier inspect resulted build.