[Tutor] Not getting what execl() should be doing...

Alan G alan.gauld at freenet.co.uk
Tue Jun 7 19:35:12 CEST 2005


> I'm trying to call up flac's encoder from a Python program. I
believe I
> should be doing it ok, but I get completely different results when
doing
> it by hand and from the python script. Here's the command line:
>
> $/usr/bin/flac --endian=little --channels=2 --sign=signed --bps=16
> --sample-rate=44100 --delete-input-file /var/data/myfile.raw
>
> This works fine when done by hand, and flac encodes the file.
>
> Inside the script, I do a fork() and then, on the child, I do:

You should probably try using the popen() family of functions instead,
or if on Python 2.4 the new commands(?) module. While your approach
can be made to work it needs a fair amount of tweaking of environments
and the like. popen otr commands should simplify life significantly.

Alan G.



More information about the Tutor mailing list