How to read with exe file files in exe file destination everytime newly when exe is executed?
If I add file with pyinstaller (--add-data) -> it's called bundled file. Then When I execute the exe file,...and I have already modified let's say edited some rows in current already EXE(bundled) folder I run exe file, then python does not see the newly modified file? It only reads the bundled one, which is like packages installed already in exe file.
This is not opinion based question; Maybe yes it is but I am trying to find an aswer to my question
I asked question yesterday, now reading pyinstaller Run time Information thoroughly,
When your app is running, it may need to access data files in one of the following locations:
Files that were bundled with it (see Adding Data Files).
Files the user has placed with the app bundle, say in the same folder.
Files in the user’s current working directory.
I am getting to think that the way I coded below, exe file only reads the file once when it was let's say pyinstalled(bundled), so before running exe file in dist folder when I edite excel file it does not read it. Is it right?
def resolve_path(path):
if getattr(sys, "frozen", False):
# If the 'frozen' flag is set, we are in bundled-app mode!
resolved_path = os.path.abspath(os.path.join(sys._MEIPASS, path))
print(resolved_path,'-+-')
else:
# Normal development mode. Use os.getcwd() or __file__ as appropriate in your case...
resolved_path = os.path.abspath(os.path.join(os.getcwd(), path))
print(resolved_path, '+-+')
return resolved_path
with pd.ExcelWriter(resolve_path('outputFile/outputData.xlsm'), engine='openpyxl', mode='a', if_sheet_exists='overlay') as writer:
book = load_workbook(resolve_path('outputFile/outputData.xlsm'), keep_vba=True)