--- a/pvl/rrd/api.py Sun Jan 20 15:42:32 2013 +0200
+++ b/pvl/rrd/api.py Sun Jan 20 18:17:29 2013 +0200
@@ -1,6 +1,7 @@
import rrdtool
import pvl.invoke
+import tempfile
import logging; log = logging.getLogger('pvl.rrd.api')
@@ -58,12 +59,14 @@
graph_file - file-like object containing graph image, unless out=False -> stdout
With out=None, the returned graph_file is a tempfile which will be cleaned up by Python once close()'d!
+
+ XXX: tempfile suffix as .png?
"""
if out is None :
# tempfile
out_file = tempfile.NamedTemporaryFile(suffix='.png', delete=True) # python2.6
- out_path = out.name
+ out_path = out_file.name
elif out is False :
out_file = None
@@ -74,6 +77,8 @@
out_path = out
out_file = True # open later
+ log.debug("%s", out_path)
+
# XXX: handle tempfile close?
width, height, out_lines = cmd(rrdtool.graph, (out_path, ), opts, args)