Sublime Forum

Access variables Sublime Text reads via 'shell_environment'

#1

Sublime Text has a shell_environment config that launches shell and gets the environment variables.

Is it possible to get access to this data via some plugin API?

0 Likes

#2

The environment is set for plugins, so the standard os.environ in python would be how you access it.

1 Like

#3

I just check $PATH before posting, and import os; os.environ['PATH']; in Sublime’s console was smaller than running the shell_environment command and echo $PATH, so I assumed it was diferent, but I guess some shell configs are to blame

0 Likes

#4

ST queries the environment from a login shell, so it won’t run all the same scripts as a terminal would.

1 Like

#5

Thanks, I’ve run the fish -l command in the terminal, so it was the same login, but then there is also another interactive check, which explains the difference

0 Likes