1# Python script to get both the data and resource fork from a BinHex encoded 2# file. 3# Author: Taro Muraoka 4# Last Change: 2003 Oct 25 5 6import sys 7import binhex 8 9input = sys.argv[1] 10conv = binhex.HexBin(input) 11info = conv.FInfo 12out = conv.FName 13out_data = out 14out_rsrc = out + '.rsrcfork' 15#print 'out_rsrc=' + out_rsrc 16print 'In file: ' + input 17 18outfile = open(out_data, 'wb') 19print ' Out data fork: ' + out_data 20while 1: 21 d = conv.read(128000) 22 if not d: break 23 outfile.write(d) 24outfile.close() 25conv.close_data() 26 27d = conv.read_rsrc(128000) 28if d: 29 print ' Out rsrc fork: ' + out_rsrc 30 outfile = open(out_rsrc, 'wb') 31 outfile.write(d) 32 while 1: 33 d = conv.read_rsrc(128000) 34 if not d: break 35 outfile.write(d) 36 outfile.close() 37 38conv.close() 39 40# vim:set ts=8 sts=4 sw=4 et: 41