diff options
Diffstat (limited to 'query/__init__.py')
-rw-r--r-- | query/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/query/__init__.py b/query/__init__.py index 28c11a4..40c645b 100644 --- a/query/__init__.py +++ b/query/__init__.py @@ -32,9 +32,9 @@ class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): s.end_headers() dot = args['top_block'].query(json.dumps(dict(path='/flows.dot'))) import subprocess - open("/tmp/dot.dot", 'w').write(dot) - subprocess.check_call(["dot", "-T", "png", "-o", "/tmp/dot.png", "/tmp/dot.dot"]) - s.wfile.write(open("/tmp/dot.png").read()) + p = subprocess.Popen(args=["dot", "-T", "png"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate(input=dot) + s.wfile.write(stdout) return #handle json requests |