pyinstaller adding data from csv

22 views
Skip to first unread message

Dallon Durfey

unread,
Jun 30, 2019, 5:25:50 AM6/30/19
to PyInstaller
So I'll start off by saying I'm somewhat new to python and using pyinstaller, but I've been reading a lot and cannot find a solution to the problem I'm experiencing 

I'm trying to bundle a csv file with some data when using pyinstaller. I've successfully done this by by using the --add-data command, as well as modifying the spec file. 

The problem I'm having is that once the bundle is complete, the path I've specified in my python code references the csv file in the original folder, not the one that was bundled with the exe, so when I try to run the exe on another computer, it crashes because that file doesn't exist. 

How can I fix this problem? I'm assuming I'll need to change the path to something different in my actual python code, but I'm not sure how to do this or what the path should be. Can someone help me? 

renscy

unread,
Aug 4, 2019, 8:17:34 AM8/4/19
to PyInstaller
I'm guessing you've used absolute paths to your csv file rather than relative paths?
Reply all
Reply to author
Forward
0 new messages