chameleon: Port test_server to python3
This binary is run in the host. We can port it to python3.
BUG=b:148751927
TEST=./test_server --chameleon_host=${DUP_IP}
Change-Id: I9eccaaa71100882bfd16c36ff5df280d21bf9de3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/chameleon/+/2089193
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
Commit-Queue: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
diff --git a/client/test_server.py b/client/test_server.py
index 2f89671..f498a5b 100755
--- a/client/test_server.py
+++ b/client/test_server.py
@@ -1,12 +1,10 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A simple utility to connect to Chameleond in an interactive shell."""
-from __future__ import print_function
-
import atexit
import argparse
import code
@@ -16,9 +14,7 @@
import rlcompleter
import subprocess
import time
-# TODO: import xmlrpclib form xmlrpc in Python 3
-# pylint: disable=W1648
-import xmlrpclib
+import xmlrpc.client
from audio.audio_value_detector import AudioValueDetector
@@ -227,7 +223,7 @@
else:
address = 'http://%s:%s' % (options.host, options.port)
- proxy = xmlrpclib.ServerProxy(address)
+ proxy = xmlrpc.client.ServerProxy(address)
logging.info('Connected to %s with MAC address %s', address,
proxy.GetMacAddress())
ShowMessages(proxy)