Forgive me if this is a silly question:
I’ve set my API key as an environment variable of my computer, as per OpenAI’s instruction.
I have no problem fetch it in a Jupiter notebook using simple os.getenv(“OPENAI_API_KEY”);
but when I copy paste my code into Visual Studio 2019, it’s not able to get this environment variable, os.getenv returns NONE.
My question:
- Why os.getenv() cannot get result in VS, but get result in a JupyterNotebook?
Does Visual Studio 2019 create some sandbox environment so os.getenv() does not have access to the computer system?
- Say if I packaged my code into a exe, send it to other people, can the code get environment variable from their computer, assuming they correctly set up and named their environment variable for API key?
Thank you.