handle a log file.

Josiah Carlson jcarlson at uci.edu
Thu Oct 7 11:38:45 EDT 2004


> I've a GUI program (wxPython) that comunicates with a machine with UDP
> sockets. Every sended socket is writted to file for inspection if
> there is problem. What ocurs is that sometimes the file grows to much
> (32Mb) and the program has problems to manage it. Is any way to
> control the size of the file?

if f.tell() > 2**25:
    print "my file is to big"
    fn = f.name
    f.close()
    #destroy the logfile
    f = open(fn, 'w')

Probably not precisely what you want, but it will "control the size of
the file".

 - Josiah




More information about the Python-list mailing list