import sys,os sys.path.insert(0,os.path.dirname(os.path.abspath(__file__))) import prt,psb for f in sys.argv[1:]: b=open(f,'rb').read() p,root,e=psb.parse(b) print(os.path.basename(f),len(b),p.p,'fields',p.nid,'lenient',p.lenient,'OK' if e is None else 'ERR '+repr(e)) if e is not None: prt.hexdump(b,max(0,p.p-64),128) if root: out=[root[0]+':']; psb.fmt(root[1],1,out) open(f[:-4]+'.txt','w',encoding='utf-8').write('\n'.join(out))