In English: I don't know much about python and I won't have much time to learn much about it even if it seems powerful...
import sys import ixio import os M = ixio.getMAC("eth0") S = "%08X %08X" % (M[0] | M[1]<<8 | M[2]<<16 | M[3]<<24, M[4] | M[5]<<8) K = "Errorin:" if len(sys.argv) <> 3: print "Usage %s <src-file> <dst-file>" % sys.argv[0] else: I = open(sys.argv[1],"rb")#ouverture de tpsd.pre avec le flag rb pour read in binary mode O = open(sys.argv[2],"wb") while 1: blk = I.read(1<<13) try: i = blk.index(K) blk = "%sErrorin:%s%s" \ % (blk[:i],S,blk[i+len(K)+len(S):]) O.write(blk) except ValueError: O.write(blk) if len(blk)<1<<13: break O.close() I.close() Here is an error I get trying to run this script: AttributeError: 'string' object has no attribute 'index' According to me, index() is a method of the string class but not an attribute. So I don't understand the error message. Be aware that I'm using pyhton 1.5, unfortunately... Another question: "1<<13" is supposed to be a size in bytes but can you explain to me how to read this? Thanks for helping me understanding the error message and size thing!! -- http://mail.python.org/mailman/listinfo/python-list