Python Forum

Full Version: pyinstaller not working with acoustics module
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
On Windows 10, the following code in iec_61672_1_2013.py from the acoustics module:
WEIGHTING_DATA = pd.read_csv(
    io.BytesIO(pkgutil.get_data('acoustics', os.path.join('data', 'iec_61672_1_2013.csv'))), sep=',', index_col=0)
causes the single-package executable to fail trying to load some internal data.

File "C:\Users\bayki\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\acoustics\standards\iec_61672_1_2013.py", line 43, in <module>
File "pkgutil.py", line 637, in get_data
File "C:\Users\bayki\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 475, in get_data
with open(path, 'rb') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\bayki\\AppData\\Local\\Temp\\_MEI48522\\acoustics\\data\\iec_61672_1_2013.csv'

Is there some way of adding this file as a resource?
Thanks
Finally got it working after reading a number of other posts. It is not immediately obvious that I had to use double quotes and a semi-colon on Windows. After copying the csv file to the local directory the following command worked.

pyinstaller -wF --add-data "iec_61672_1_2013.csv;acoustics\data" kiwiCallFinder.py