Commit b8e1e865 authored by eric pellegrini's avatar eric pellegrini
Browse files

Bug fix when setting info about the job in ASCII and SVG files

parent dcfd1f89
...@@ -66,16 +66,13 @@ class ASCIIFormat(IFormat): ...@@ -66,16 +66,13 @@ class ASCIIFormat(IFormat):
''' '''
filename = os.path.splitext(filename)[0] filename = os.path.splitext(filename)[0]
filename = "%s_%s.tar" % (filename,cls.type) filename = "%s.tar" % filename
tf = tarfile.open(filename,'w') tf = tarfile.open(filename,'w')
for var in data.values(): for var in data.values():
tempStr = StringIO.StringIO() tempStr = StringIO.StringIO()
if header:
tempStr.write(header)
tempStr.write('\n\n')
tempStr.write(var.info()) tempStr.write(var.info())
tempStr.write('\n\n') tempStr.write('\n\n')
cls.write_array(tempStr,var) cls.write_array(tempStr,var)
...@@ -85,6 +82,15 @@ class ASCIIFormat(IFormat): ...@@ -85,6 +82,15 @@ class ASCIIFormat(IFormat):
info.size=tempStr.len info.size=tempStr.len
tf.addfile(tarinfo=info, fileobj=tempStr) tf.addfile(tarinfo=info, fileobj=tempStr)
if header:
tempStr = StringIO.StringIO()
tempStr.write(header)
tempStr.write('\n\n')
tempStr.seek(0)
info = tarfile.TarInfo(name='jobinfo.txt')
info.size=tempStr.len
tf.addfile(tarinfo=info, fileobj=tempStr)
tf.close() tf.close()
@classmethod @classmethod
......
...@@ -32,6 +32,7 @@ Created on May 26, 2015 ...@@ -32,6 +32,7 @@ Created on May 26, 2015
import os import os
import re import re
import StringIO
import tarfile import tarfile
import numpy import numpy
...@@ -103,4 +104,13 @@ class SVGFormat(IFormat): ...@@ -103,4 +104,13 @@ class SVGFormat(IFormat):
os.remove(svgfilename) os.remove(svgfilename)
if header:
tempStr = StringIO.StringIO()
tempStr.write(header)
tempStr.write('\n\n')
tempStr.seek(0)
info = tarfile.TarInfo(name='jobinfo.txt')
info.size=tempStr.len
tf.addfile(tarinfo=info, fileobj=tempStr)
tf.close() tf.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment