Here's my script:
try:
os.environ['CONSOLE'] = '1'
while True:
...
except KeyboardInterrupt:
del os.environ['CONSOLE']
I'm trying to set an environment variable called CONSOLE
. While this program is running that variable should exist, once I exit out of it with Ctrl+C it should disappear.
When I leave the program running and try printing it from my shell, however, I get:
$ echo $CONSOLE
CONSOLE: Undefined variable.
I can't seem to read it from my PHP script either. Where's my variable? I thought os.environ
should allow me to do this?