I created an executable with this code and pyinstaller:
import soundfile
print("Hello!")
input("Ok")
But it doesn't run correctly. I get the following error:
Traceback (most recent call last):
File "lib\site-packages\soundfile.py", line 142, in <module>
OSError: sndfile library not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "prueba.py", line 1, in <module>
import soundfile
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\Users\DianaCarolina\Google Drive\Humboldt\DTF_GUI\venv1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\soundfile.py", line 163, in <module>
OSError: cannot load library 'C:\Users\DianaCarolina\Google Drive\Humboldt\DTF_GUI\dist\prueba\_soundfile_data\libsndfile32bit.dll': error 0x7e
[9780] Failed to execute script prueba
Since I used the standard pyinstaller command pyinstaller prueba.py
I was able to make the executable work by copying the original _soundfile_data folder in the dist folder. However, I would like to use the --onefile option to make my program easier to distribute. How can I make pyinstaller work as it is supposed to?