Hello,

Alex new_name at mit.edu
Sat Jul 21 14:14:15 EDT 2001


Not really.  There are some ways you could speed up the python code:

def LogError(msg):
   old = open("./error.log", "r").read()
   err = open("./error.log", "w")
   err.write(msg)
   err.write(old)

...but you're still going to be reading a lot from the disk only to
write it straight back out again.  There's the additional problem that
opening "err" will truncate the log file, and if an error occurs while
you're writing the new version back, you could lose messages.

HTH.
Alex.



More information about the Python-list mailing list