Salome HOME
Increment version: 9.5.0
[modules/yacs.git] / Demo / xmlrpcprog_orig.py
index d1e17ee5dd6adde40131d0a1dfe8998515ea7e2a..54101c04a594f8a4b1fd893315de15688be820f1 100755 (executable)
@@ -1,10 +1,10 @@
-#!/usr/bin/env python
-# Copyright (C) 2006-2013  CEA/DEN, EDF R&D
+#!/usr/bin/env python3
+# Copyright (C) 2006-2020  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import xmlrpclib,sys
+import xmlrpc.client,sys
 
 data="""
 <methodCall>
@@ -31,14 +31,14 @@ data="""
 </methodCall>
 """
 def echo(args):
-  print args
+  print(args)
   return 96785439
 
 f=open("input")
 data=f.read()
 f.close()
 
-params, method = xmlrpclib.loads(data)
+params, method = xmlrpc.client.loads(data)
 
 try:
    call=eval(method)
@@ -46,11 +46,11 @@ try:
    response = (response,)
 except:
    # report exception back to server
-   response = xmlrpclib.dumps( xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]))
+   response = xmlrpc.client.dumps( xmlrpc.client.Fault(1, "%s:%s" % sys.exc_info()[:2]))
 else:
-   response = xmlrpclib.dumps( response, methodresponse=1)
+   response = xmlrpc.client.dumps( response, methodresponse=1)
 
-print response
+print(response)
 f=open("output",'w')
 f.write(response)
 f.close()