qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qmp: make qmp-shell work with python3
@ 2019-06-18 14:29 Igor Mammedov
  2019-06-19 13:29 ` Cleber Rosa
  0 siblings, 1 reply; 5+ messages in thread
From: Igor Mammedov @ 2019-06-18 14:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru, ehabkost, crosa

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 <imammedo@redhat.com>
---
 scripts/qmp/qmp-shell | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index 7776c7b141..8c49b39afa 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -308,7 +308,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
         @return True if execution was ok, return False if disconnected.
         """
         try:
-            cmdline = raw_input(prompt)
+            try: # attempt to set Python2 override
+               import __builtin__;
+               getattr(__builtin__, 'raw_input', input)
+            except ModuleNotFoundError: pass
+            cmdline = input(prompt)
         except EOFError:
             print()
             return False
-- 
2.18.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-20 15:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 14:29 [Qemu-devel] [PATCH] qmp: make qmp-shell work with python3 Igor Mammedov
2019-06-19 13:29 ` Cleber Rosa
2019-06-20  9:11   ` Igor Mammedov
2019-06-20 13:45     ` Eduardo Habkost
2019-06-20 15:16       ` Igor Mammedov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).