Unable to access environment variables

I’ve added an environment variable named MYVAR (and confirmed by running gp env), but this Python code returns None:
import os
print(os.environ.get(‘MYVAR’))

What am I doing wrong?

Hey @tallgaijin, did you create the environment variable after starting the workspace? If that’s the case, you could try restarting the workspace. Let me know if this helps. :ping_pong:

That was it, thanks. Works after a restart.

1 Like