Qualifier quite new to Python. I wrote some Python code importing pandas, selenium, sys, os, tkinter, and pillow, then put together with pyinstaller and NSIS. The programme uses a csv file for its input and updates this based on user actions. The updates are to be saved internally so if the user quits they can continue where they left off. It all saves properly, user progress saves and picks up correctly, and if I "download CSV" the file is up-to-date. It all works perfectly, functionally speaking.
However, when the programme is run, the csv that it starts with is not where it is saving the progress. It stays the same. The "progress" data is being saved somewhere else From a data security perspective, I need to know where it is saving. I could not find it after hours of looking.
Even if I uninstall the programme and reinstall, it still remembers the progress. Tested also on machines with no Python etc.
I am using:
if getattr(sys, 'frozen', False):
CurrentPath = sys._MEIPASS
else:
CurrentPath = os.path.dirname(__file__)
Could that be it? The save line itself is rather standard:
df.to_csv('file_s.csv',encoding='utf-8', index=False)
My only other idea is it relates to NSIS installer and the uninstall script. There are painfully few tutorials for beginners on that. If the community thinks that is the issue, I think it best I post a new question with relevant info.
Apologies if this is too vague and happy to provide anymore needed info!
You are defining the CurrentPath
variable using the standard "if frozen" approach, which looks OK. But, you don't then seem to use it when you save the file.
Try explicitly concatenating it with the filename to save
df.to_csv(os.path.join(CurrentPath,'file_s.csv'),encoding='utf-8', index=False)
Note that when you run as a executable, sys._MEIPASS
will be a temporary folder created (on Windows atleast) somewhere like C:\Users\<you>\AppData\Local\Temp\MEIXXX