from server import process_id, Server
import json
import subprocess
+from salomeContextUtils import ScriptAndArgsObjectEncoder
# -----------------------------------------------------------------------------
pass
pass
if self.args.has_key('pyscript') and len(self.args['pyscript']) > 0:
- msg = json.dumps(self.args['pyscript'])
+ msg = json.dumps(self.args['pyscript'], cls=ScriptAndArgsObjectEncoder)
self.SCMD2+=['--pyscript=%s'%(msg)]
pass
pass
import subprocess
import re
import socket
+import json
"""
Define a specific exception class to manage exceptions related to SalomeContext
self.args = args
self.out = out
#
+class ScriptAndArgsObjectEncoder(json.JSONEncoder):
+ def default(self, obj):
+ if isinstance(obj, ScriptAndArgs):
+ # to be easily parsed in GUI module (SalomeApp_Application)
+ # Do not export output arguments
+ return {obj.script:obj.args or []}
+ else:
+ return json.JSONEncoder.default(self, obj)
+#
# Return an array of ScriptAndArgs objects
def getScriptsAndArgs(args=None, searchPathList=None):