libsndfile32bit.dll path
See original GitHub issueHi, I was building a package with PyInstaller for a python script that calls PySoundFile functions. The DLLs are bundled into a ‘dist’ folder together with a Windows EXE of the program. However, when I ran the EXE, an error occurred in soundfile.py as it was looking for libsndfile32bit.dll in …_soundfile_data folder though the DLL is already bundled into the same directory as the EXE.
When I looked into soundfile.py, the following section looks like the part that searches the DLL:
try:
_snd = _ffi.dlopen('sndfile')
except OSError as err:
if _sys.platform == 'darwin':
_libname = 'libsndfile.dylib'
elif _sys.platform == 'win32':
from platform import architecture as _architecture
_libname = 'libsndfile' + _architecture()[0] + '.dll'
else:
raise
_snd = _ffi.dlopen(_os.path.join(
_os.path.dirname(_os.path.abspath(__file__)),
'_soundfile_data', _libname))
Is there a better way to go about doing this as I would have to manually create “_soundfile_data” in the dist folder in order for the program to run correctly.
Thanks.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
do pip install pysoundfile
@tritipsteak IIRC,
sndfile.dll
is only found byctypes
/CFFI if you put it somewhere in the WindowsPATH
.Did you try putting it in
_soundfile_data\libsndfile32bit.dll
(relative to the dist folder)?There is this hack (see #192) which might work for this:
https://github.com/bastibe/SoundFile/blob/43c457e73984f15ca5c5ad47390dcc8e913da3c1/soundfile.py#L153-L163