continued working on reading header of output file

This commit is contained in:
Martin Diehl 2010-11-30 14:26:30 +00:00
parent 9d32bc7ae6
commit ab82dbc99c
1 changed files with 33 additions and 12 deletions

View File

@ -1,18 +1,39 @@
import binascii
print('post processing for mpie_spectral')
results = open('results.out', 'rb')
header = results.read(4)
end = results.read(1024).find(header)
results.seek(4)
loadcase = results.read(end)
header = results.read(4) #read header
begin = results.tell()
end = results.read(1024).find(header) #find header (second time)
results.seek(begin+9) #position: header + string "loadcase "
#loadcase = binascii.b2a_base64(results.read(end-9)) #conversion doesnt work
loadcase = results.read(end -9)
print('loadcase:', loadcase)
#
begin = end
results.seek(end+4)
results.seek(begin+end+4)
header = results.read(4)
print(header)
end = results.read(1024).find(header)
#results.seek(4)
#workingdir = results.read(end)
#print('workingdir:', workingdir)
begin = results.tell()
end = results.read(1024).find(header) #find header (second time)
results.seek(begin+11) #position: header + string "workingdir "
workingdir = results.read(end -11)
print('workingdir:', workingdir)
#
results.seek(begin+end+4)
header = results.read(4)
begin = results.tell()
end = results.read(1024).find(header) #find header (second time)
results.seek(begin+8) #position: header + string "workingdir "
jobname = results.read(end -8)
print('jobname:', jobname)
header = b'a'
results.seek(begin+end+19)
print(results.seek(begin+end+19))
begin = results.read(1024).find(header)
print(begin)