qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] qmp: make qmp-shell work with python3
@ 2019-06-20 15:40 Igor Mammedov
  2019-06-20 16:26 ` Eduardo Habkost
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Mammedov @ 2019-06-20 15:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: crosa, armbru, ehabkost

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>
---
v2:
 use sys.version_info[0] instead try/except 
    (Cleber Rosa <crosa@redhat.com>)

 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.1



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

* Re: [Qemu-devel] [PATCH v2] qmp: make qmp-shell work with python3
  2019-06-20 15:40 [Qemu-devel] [PATCH v2] qmp: make qmp-shell work with python3 Igor Mammedov
@ 2019-06-20 16:26 ` Eduardo Habkost
  0 siblings, 0 replies; 2+ messages in thread
From: Eduardo Habkost @ 2019-06-20 16:26 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: crosa, qemu-devel, armbru

On Thu, Jun 20, 2019 at 11:40:35AM -0400, Igor Mammedov wrote:
> 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>

Queued, thanks.

-- 
Eduardo


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 15:40 [Qemu-devel] [PATCH v2] qmp: make qmp-shell work with python3 Igor Mammedov
2019-06-20 16:26 ` Eduardo Habkost

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).