python and os.system() failure



Hi,

I'm actually not sure where the error is actually occurring, but the
effects are easily reproduced, but not reproducable. By not
reproducable, I mean the error does not occur exactly in the same
"spot" but it always happens.

I have my CD collection ripped to flac, so I have >4000 flacs. I wrote
this script that will automatically encode the flacs into mp3 or ogg
while transferring all the metaflac info over to id3 tag of the mp3.

Generally, the script works like this:

Get list of flac
for each flac file:
Store metaflac_info in an information class
os.system(decode flac using /usr/bin/flac)
os.system(encode mp3 and embed info stored in class)

Now, this script will go on for some time but after 40-100 files the
decode will fail with /usr/bin/flac reporting an error in reading the
flac file.

..flac: ERROR while decoding data
state = FLAC__STREAM_DECODER_READ_FRAME

The script fails to decode any more flac files until the vm
crashes from having too many open files.

The flac file is perfectly fine, though. Restarting the script, the
flac file that "crashed" decodes/encodes just fine. Analysis by 'flac
-t' or 'flac -a' show a correct flac file. How ever, if I try to
decode a "bad" flac file in parallel with the script after the script
has "failed", I can't decode the flac and get the same error. Yet, I
can do 'flac -a' or 'flac -t' on the file and it reports 100% good in
parallel to the "dead" script.

It is not a disk space issue as I've checked. No stray tempfiles are
created since the command to create them fails when opening the flac
file.

I have tried invoking garbage collection after a set number of file
and sleeping the thread after running into the error, but neither
worked. The most likely culprit is my script, but it seems too simple
to "die" like that. I don't think it's a problem with the 'flac'
application. Another possible culprit is a python VM issue that I am
not aware of.

Any advice would be appreciated,

Kenny

Debian Linux, i686
Python 2.3 (2.3.5-2) and earlier versions of 2.3
flac 1.1.1 (1.1.1-5)



.



Relevant Pages

  • Re: OT - Burning Flac files to CD with Roxio
    ... I've been using .flac file format for uploads because I've been told that it is "lossless" and works for PC and Mac platforms. ... it's not that easy to interpret the "About Roxio" window. ... I probably have other software to do this, but does anybody know how I can upgrade Roxio to accept .flac file format? ... I use Switch to convert to .wav, and which is free if one only wants to convert from .flac to .wav, but there is other software available. ...
    (rec.music.classical.recordings)
  • Unit tests and destructive methods
    ... As my flac library approaches 1000 lines of code I decided it would be prudent ... to finally get around to writing some unit tests, ... have created a 'reference' flac file with known values, ... I am thinking that I need to write code which makes a copy of the reference ...
    (comp.lang.ruby)
  • Re: MP2/MP3 samples
    ... players/headphones. ... Generally FLAC for headphones and FLAC or the highest supported MP3 rate, transcoded from the FLAC file. ...
    (alt.radio.digital)
  • Re: MP2/MP3 samples
    ... > LOL, I do :-), I meant the source material, as opposed to the 128mp3 ... Generally FLAC for headphones and FLAC or the highest supported MP3 ... transcoded from the FLAC file. ... Perhaps if that becomes possible you could do a 160 and 192 kbps ...
    (alt.radio.digital)
  • Re: Impenetrable bash quoting problem (script to convert .APE to .FLAC)
    ... the flac executable interprets the ... >> I am including the actual script here at the end of this post. ... > Now since you manage to print the correct command line, ... It is interesting to me that the second echoargs invocation acts the way ...
    (comp.unix.shell)