[Tutor] Not getting what execl() should be doing... OK I GOT IT
Hugo González Monteverde
hugonz-lists at h-lab.net
Tue Jun 7 10:14:03 CEST 2005
Just replying to myself because I am extremely dumb, so maybe it will
help someone along the way if the same thing happens.
I forgot to include argv[1], which is basically the same as the name of
the file to be run.
So:
os.execl(tw_comppath, tw_comppath, "--endian=little", "--channels=2",
"--sign=signed", "--bps=16", "--sample-rate=44100",
"--delete-input-file", "%s"%filepath)
does the trick.
Thanks anyway tutors...
Hugo González Monteverde wrote:
> Hi all,
>
> 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:
>
>
> tw_comppath = "/usr/bin/flac"
> filepath = "/var/data/myfile.raw"
>
> os.execl(tw_comppath, "--endian=little", "--channels=2",
> "--sign=signed", "--bps=16", "--sample-rate=44100",
> "--delete-input-file", "%s"%filepath)
>
> In this case, the FLAC binary complains about not getting the proper
> options (endian, channels, etc), but it claims it is getting
> --delete-input-file.
>
> What am I doing wrong? I cannot seem to pass the parameters right using
> execl....
>
> Thanks for your enlightening....
>
> Hugo
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list