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):
'''
filename = os.path.splitext(filename)[0]
filename = "%s_%s.tar" % (filename,cls.type)
filename = "%s.tar" % filename
tf = tarfile.open(filename,'w')
for var in data.values():
tempStr = StringIO.StringIO()
if header:
tempStr.write(header)
tempStr.write('\n\n')
tempStr.write(var.info())
tempStr.write('\n\n')
cls.write_array(tempStr,var)
......@@ -84,6 +81,15 @@ class ASCIIFormat(IFormat):
info = tarfile.TarInfo(name='%s%s' % (var.name,cls.extensions[0]))
info.size=tempStr.len
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()
......
......@@ -32,6 +32,7 @@ Created on May 26, 2015
import os
import re
import StringIO
import tarfile
import numpy
......@@ -102,5 +103,14 @@ class SVGFormat(IFormat):
tf.add(svgfilename, arcname='%s%s' % (var.name,cls.extensions[0]))
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()
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