Skip to content

Commit ba2d7bb

Browse files
committed
More Python 3 support. #17
1 parent 85d235d commit ba2d7bb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/robotremoteserver.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
from StringIO import StringIO
2929
from SimpleXMLRPCServer import SimpleXMLRPCServer
3030
from xmlrpclib import Binary
31-
PY3 = False
31+
PY2, PY3 = True, False
3232
else:
3333
from io import StringIO
3434
from xmlrpc.client import Binary
3535
from xmlrpc.server import SimpleXMLRPCServer
36-
PY3 = True
36+
PY2, PY3 = False, True
3737
unicode = str
3838
long = int
3939

@@ -314,7 +314,10 @@ def _write_to_stream(self, msg, stream):
314314

315315

316316
if __name__ == '__main__':
317-
import xmlrpclib
317+
if PY2:
318+
from xmlrpclib import ServerProxy
319+
else:
320+
from xmlrpc.client import ServerProxy
318321

319322
def stop(uri):
320323
server = test(uri, log_success=False)
@@ -323,7 +326,7 @@ def stop(uri):
323326
server.stop_remote_server()
324327

325328
def test(uri, log_success=True):
326-
server = xmlrpclib.ServerProxy(uri)
329+
server = ServerProxy(uri)
327330
try:
328331
server.get_keyword_names()
329332
except:

0 commit comments

Comments
 (0)