Skip to content

Commit 763cfea

Browse files
For Python 2.7, raw_input is needed to request input; also ensure that sample
parameters are saved once requested.
1 parent 983dfda commit 763cfea

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

samples/SampleEnv.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
import os
4444
import sys
4545

46+
# for Python 2.7 we need raw_input
47+
try:
48+
input = raw_input
49+
except NameError:
50+
pass
51+
4652
# default values
4753
DEFAULT_MAIN_USER = "pythondemo"
4854
DEFAULT_EDITION_USER = "pythoneditions"
@@ -70,6 +76,7 @@ def GetValue(name, label, defaultValue=""):
7076
value = getpass.getpass(label)
7177
if not value:
7278
value = defaultValue
79+
PARAMETERS[name] = value
7380
return value
7481

7582
def GetMainUser():

test/TestEnv.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
import sys
5050
import unittest
5151

52+
# for Python 2.7 we need raw_input
53+
try:
54+
input = raw_input
55+
except NameError:
56+
pass
57+
5258
# default values
5359
DEFAULT_MAIN_USER = "pythontest"
5460
DEFAULT_PROXY_USER = "pythontestproxy"

0 commit comments

Comments
 (0)