examples: fix usage of input() with Python2
input() in Python2 evaluated the string and was thus unsafe. On Python2, the right choice is raw_input. In Python3, input does what raw_input did. Work around this. The main "problem" is that lgtm.com flags this as error. The fix in the example is not important, but getting a low number of warnings is.
This commit is contained in:
@@ -54,6 +54,12 @@ for arg in sys.argv[2:]:
|
||||
checkpoint = manager.CheckpointCreate(devList, interval, 1)
|
||||
# DESTROY_ALL
|
||||
|
||||
try:
|
||||
# Workaround for Python2
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
choice = input("Do you want to rollback [y/n]? ").lower()
|
||||
if choice == "y":
|
||||
print("Rollback checkpoint")
|
||||
|
Reference in New Issue
Block a user