File IO question.

J Poirier oo1z at yahoo.com
Thu Jul 15 21:34:52 CEST 2004


--- Chris Cioffi <evenprimes at gmail.com> wrote:
> On Thu, 15 Jul 2004 10:12:42 -0700 (PDT), J Poirier
> <oo1z at yahoo.com> wrote:
> [snip]> The trace files tend to accumulate as
> they're not
> > always deleted once archived to a network
> database,
> > and often times a machine will crash in the middle
> of
> > a
> > very long test due to the hard drive filling up.
> [snip]
> > I messed around with the mmap and file object
> stuff
> > as well as the win32 extensions thinking that I
> could
> > extract and compress the data that was being
> written
> > to
> > the trace file, by the application, in chuncks.
> > 
> > Although I was able to get it to work on a
> contrived
> > setup, it didn't work when used with the real
> > application.
> > 
> > Any hints on how to get something similar to the
> above
> > to work or recommendations on alternate solutions
> > would
> > be *greatly* appreciated.
> > 
> 
> Well if you're using the logging class from Python
> 2.3 you could
> switch your handler to a RotatingFileHandler. 
> Depending on exactly
> what you're trying to do perhaps a custom handler
> class that would
> rotate on each program run and wrote out to a
> gzip'ed file?
> 
> Yet another idea is to use the SysLogHandler or
> SocketHandler and log
> directly to the remote machine.
> 
> Chris
> -- 
> Still searching for an even prime > 2!
> 

First, I apologize for not posting the code I used to
do the test but it was lost when I changed laptops... 
:-(

The ideal solution would be a script that could be run
when the tester starts the test application and that 
would remove data from the trace file periodically.

Note that the test application prompts for a file or
there's an option to create one.
 
For some reason the test application wasn't writing
anything to the trace file when I had my script hooked
in to it. I was able to get other applications to
work with my script, it owrked similar to what's shown
in the Python In A Nutshell book. 

I worked with the file permissions as well as several
other file parameters as shown in the Python Win32
book
but nothing seemed to work with the test application.
  
-Joe






		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 



More information about the Python-list mailing list