Hi def cript(doc=None,data =None): if doc==None and data==None:doc=sys.agv1 elif doc: data=open(doc,'r').read() data_c= binascii.hexlify(data) else:data_c= binascii.hexlify(data) if doc: q=tempfile.TemporaryFile() q.write(data_c) os.rename(q,doc) return return data_c
cript(doc='./language.txt') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 10, in cript TypeError: coercing to Unicode: need string or buffer, file found 1)Why I got the above error message with the above function?How to correct it? 2)Is it reasonable to have 2 if blocks in a function as above? 3)Dose the tempfile create a fileobject on harddisk or in memory(Dose it save my file as I expect it to do) Please someone enlighten me. Prasad _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor