I am using filename = os.environ.get('HIRES_2023_FILE')
to get a filename. The file is located in the directory of the python executable and I want it always to reside there as the executable will be distributed to different machines/locations.
If I set the environment variable to HIRES_2023_FILE = 2023_hires.csv
it can't find it. If I set it to .\HIRES_2023_FILE = 2023_hires.csv
it's read as .\\2023_hires.csv
. I've tried using str.replace
to no avail, it strips both \\
.
Can anyone tell me how I can convert that into a correct filename so my open
reads the file?