I need check if input variable is set, I use python 3.5, example:
./update-stack.py stack-name
(with stack-name as argument works)
instead
./update-stack.py
(without stack-name i have an error)
Traceback (most recent call last):
File "update-stack.py", line 22, in <module>
stack = sys.argv[1]
IndexError: list index out of range
I have write this for check this:
if len(sys.argv) <= 0:
print('ERROR: you must specify the stack name')
sys.exit(1)
stack = sys.argv[1]
How to see the print
instead error?
Thanks