Good afternoon all.
I hope that you are well.
I have a Python script that I would like to share with others, however it relies on the executable file being able to read a value from a .env file stored within the same location as where the executable is being ran from. I am running Mac OSX.
Here is some example code :-
import os from dotenv
The aim is to convert my script into a command executable file and then for it to be able to read from an editable .env file within the same directory as the executable file. If the .env file is edited and saved, the next time the executable is ran, the output will be the contents of the newly saved .env file.
I have converted my script to an executable using the following command :-
pyinstaller --onefile main.pyThis results in a dist folder being created with the executable file in there. If I place the .env file in the same directory as the executable file, then the output of the exe returns "None" whereas I would expect it to return "This is a new test environment variable" as per my .env file contents :-
TEST_ENVIRONMENT_VARIABLE = "This is a new test environment variable"Any help would be greatly appreciated.
Many thanks James
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/50b7392d-cbb1-40bc-b038-5900b3253df3n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/CAB8Wu-K57Tv4HXSqSz56%3D2rnxi4tbYSpFAQawN%2BnPW8HdaBjHw%40mail.gmail.com.