user1187968
user1187968

Reputation: 7986

Travis environment variable (Python)

I have set up "ENVIRONMENT" as an environment variable in the Travis console, but when Travis runs, it still can't access the variable in Python. Any idea?

  File "/home/travis/build/.../config/env.py", line 12, in set
    builtins.environment = os.environ['ENVIRONMENT']
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/os.py", line 669, in __getitem__
    raise KeyError(key) from None
KeyError: 'ENVIRONMENT'

Upvotes: 0

Views: 237

Answers (1)

Jean-François Fabre
Jean-François Fabre

Reputation: 140148

I'll attempt an answer, as it's the only reason I can think of.

on Linux/unix bash/ksh, doing:

ENVIRONMENT=somevalue

doesn't propagate the value to children processes. You have to export (in bash):

export ENVIRONMENT=somevalue

Upvotes: 2

Related Questions