python and os.system() failure

kennywiggin kennywiggin at yahoo.com
Fri Apr 29 20:11:49 EDT 2005


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)






More information about the Python-list mailing list