Skip to content

Commit 1ff41d5

Browse files
authored
Merge pull request #20329 from ccordoba12/issue-20309
PR: Catch any possible error when trying to get the user environment variables (Utils)
2 parents 4ec9249 + 0c7c1fb commit 1ff41d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spyder/utils/environ.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ def get_user_environment_variables():
5757
cmd = "printenv"
5858
proc = run_shell_command(cmd)
5959
stdout, stderr = proc.communicate()
60-
res = stdout.decode().strip().split(os.linesep)
60+
61+
try:
62+
res = stdout.decode().strip().split(os.linesep)
63+
except Exception:
64+
return {}
65+
6166
env_var = {}
6267
for kv in res:
6368
try:

0 commit comments

Comments
 (0)