(OT) python file-truncate on fc10 zero-fills file: who to ask?

John Pilkington J.Pilk at tesco.net
Thu Mar 5 15:32:48 UTC 2009


Hi:  I'm asking here because this is the most fc10-oriented list that I 
use and I thought someone might know the answer.  I'd be happy to ask 
elsewhere but don't know where might be the best place.

I'm trying to do shrink-to-fit with video files on fc10 after tcrequant 
was deprecated.  vamps looks as if it will do the job but I think I need 
to chop off a few kb from the end of the input file first to avoid a 
failure exit.  I can do this with dd but that's slow and file truncation 
would be better.  I can't see a command-line truncate but since I am 
hacking the mythburn.py script I thought I had found the answer here, in 
truncate([size]) :

http://www.python.org/doc/2.5.2/lib/bltin-file-objects.html

I've tried that.  The file size shrinks as required but the result is 
zero-filled.  Here's some stripped-down test code:

         vobsize = os.path.getsize(source)
         write("Initial vobsize is %s bytes" % vobsize)

         vobsize -= 2048
         f=open(source,'wb')
         f.truncate( vobsize )
         f.close()

         vobsize = os.path.getsize(source)
         write("vobsize after truncation is %s bytes" % vobsize)

Is this a known problem with python, or in its fc10 implementation? 
Where would be the best place to ask how to do this job?

TIA

John Pilkington



More information about the kde mailing list