[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/4] qmp: make qmp-shell work with python3
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 1/4] qmp: make qmp-shell work with python3 |
Date: |
Mon, 1 Jul 2019 19:29:09 -0300 |
From: Igor Mammedov <address@hidden>
python3 doesn't have raw_input(), so qmp-shell breaks.
Use input() instead and override it with raw_input()
if running on python2.
Signed-off-by: Igor Mammedov <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
scripts/qmp/qmp-shell | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index 7776c7b141..f1cddeafbc 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -78,6 +78,9 @@ import re
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu import qmp
+if sys.version_info[0] == 2:
+ input = raw_input
+
class QMPCompleter(list):
def complete(self, text, state):
for cmd in self:
@@ -308,7 +311,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
@return True if execution was ok, return False if disconnected.
"""
try:
- cmdline = raw_input(prompt)
+ cmdline = input(prompt)
except EOFError:
print()
return False
--
2.18.0.rc1.1.g3f1ff2140
- [Qemu-devel] [PULL 0/4] Python queue, 2019-07-01, Eduardo Habkost, 2019/07/01
- [Qemu-devel] [PULL 2/4] python/qemu: split QEMUMachine out from underneath __init__.py, Eduardo Habkost, 2019/07/01
- [Qemu-devel] [PULL 3/4] machine.py: minor delinting, Eduardo Habkost, 2019/07/01
- [Qemu-devel] [PULL 1/4] qmp: make qmp-shell work with python3,
Eduardo Habkost <=
- [Qemu-devel] [PULL 4/4] Deprecate Python 2 support, Eduardo Habkost, 2019/07/01
- Re: [Qemu-devel] [PULL 0/4] Python queue, 2019-07-01, Peter Maydell, 2019/07/04