Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | from subprocess import Popen, PIPE |
---|
3 | import json , os , sys , tempfile |
---|
4 | class_module = sys.argv[1] |
---|
5 | function_module = sys.argv[2] |
---|
6 | pipe_in = tempfile.NamedTemporaryFile().name |
---|
7 | fd = open(pipe_in,'w') |
---|
8 | args = {'args':[2,1]} |
---|
9 | json.dump(args,fd) |
---|
10 | fd.close() |
---|
11 | exec_result = Popen(["/usr/share/n4d/xmlrpc-server/core_perl_plugins.pl",class_module,function_module,pipe_in],stdout=PIPE,stderr=PIPE) |
---|
12 | result_json_path = exec_result.communicate()[0] |
---|
13 | if os.path.exists(result_json_path): |
---|
14 | fd = open(result_json_path,'r') |
---|
15 | raw_result = fd.readlines() |
---|
16 | result = json.loads(raw_result[0]) |
---|
17 | print result['result'] |
---|
18 | os.remove(result_json_path) |
---|
19 | else: |
---|
20 | print "error" |
---|
Note: See
TracBrowser
for help on using the repository browser.