try, except

This commit is contained in:
Verry Yann 2019-05-08 16:03:32 +02:00
parent fd78283db4
commit dd9eb6e08b
Signed by: yann
GPG key ID: 19754E8692B8416C

View file

@ -137,8 +137,11 @@ if __name__ == "__main__":
except KeyError:
from os.path import expanduser
home = expanduser("~")
o = open(home + '/.vault-token','r')
vault['VAULT_TOKEN'] = o.read().splitlines()[0]
try:
o = open(home + '/.vault-token','r')
vault['VAULT_TOKEN'] = o.read().splitlines()[0]
except FileNotFoundError as e:
print('Error %s variable is missing' % str(e))
if len(sys.argv) > 1:
try: