source: n4d/trunk/fuentes/install-files/usr/share/n4d/xmlrpc-server/core_perl_plugins.py @ 105

Last change on this file since 105 was 103, checked in by hectorgh, 5 years ago

adding files

File size: 679 bytes
Line 
1#!/usr/bin/env python
2from subprocess import Popen, PIPE
3import json , os , sys , tempfile
4class_module = sys.argv[1]
5function_module = sys.argv[2]
6pipe_in = tempfile.NamedTemporaryFile().name
7fd = open(pipe_in,'w')
8args = {'args':[2,1]}
9json.dump(args,fd)
10fd.close()
11exec_result = Popen(["/usr/share/n4d/xmlrpc-server/core_perl_plugins.pl",class_module,function_module,pipe_in],stdout=PIPE,stderr=PIPE)
12result_json_path = exec_result.communicate()[0]
13if 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)
19else:
20    print "error"
Note: See TracBrowser for help on using the repository browser.