factory: Use six.moves.input instead of raw_input
`raw_input` is deprecated and rename to `input` in python3.
However, `input` is a builtin function in python2. Hence, we need to use
`six.moves.input` to write py2/3 compatible code.
BUG=chromium:999876
TEST=make test
TEST=make lint and check there is no raw_input-builtin error
Change-Id: Id28d1c8b095d8c456bd444ae6ddef0eb5f7ce3cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/factory/+/1872132
Tested-by: Yilin Yang <kerker@chromium.org>
Auto-Submit: Yilin Yang <kerker@chromium.org>
Commit-Queue: Yilin Yang <kerker@chromium.org>
Reviewed-by: Yong Hong <yhong@chromium.org>
diff --git a/py/tools/regcode.py b/py/tools/regcode.py
index 0bc42f5..de934e1 100755
--- a/py/tools/regcode.py
+++ b/py/tools/regcode.py
@@ -15,6 +15,8 @@
import random
import sys
+from six.moves import input
+
import factory_common # pylint: disable=unused-import
from cros.factory.device import device_utils
from cros.factory.hwid.v3 import hwid_utils
@@ -52,7 +54,7 @@
def GenerateDummy(options):
print ('*** This may be used only to generate a code for testing, '
'not for a real device.')
- yes_no = raw_input('*** Are you OK with that? (yes/no) ')
+ yes_no = input('*** Are you OK with that? (yes/no) ')
if yes_no != 'yes':
print('Aborting.')
sys.exit(1)