I have an environment variable that I can print from the terminal:
echo $STATTLE_TOKEN
returns
"ALKJSLKJLKFJALSKJFLASJFLSAF"
When I am in ipython, I can print it using:
import os
os.getenv("STATTLE_TOKEN")
which prints
"ALKJSLKJLKFJALSKJFLASJFLSAF"
However when I fire up a new Rstudio session,
Sys.getenv("STATTLE_TOKEN")
yields
""
What am I missing? I want to leverage my system's environment variables, but obviously I am not connecting the dots onto something. I would prefer not to have to put it in a file that loads on startup for my project.
Thanks in advance.
You probably start your interactive Python differently from your RStudio session. The outcome suggests that iPython may be a child process -- maybe you launched it from the shell?
The key will be to make R(Studio) aware of these environment variables. You could always set them explicitly in ${R_HOME}/etc/Renviron.site
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With