Python commands vs unixCmd / Pipe?

Given a shell script:

cd /home/xxx/share/tools/real_time_plp
source .venv/bin/activate
python3 beatcli.py -l

From the command line, it prints:

$ ./py-get-devices.sh 
   0 sof-hda-dsp: - (hw:0,0), ALSA (2 in, 2 out)
   1 sof-hda-dsp: - (hw:0,3), ALSA (0 in, 2 out)
   2 sof-hda-dsp: - (hw:0,4), ALSA (0 in, 2 out)
   3 sof-hda-dsp: - (hw:0,5), ALSA (0 in, 2 out)
   4 sof-hda-dsp: - (hw:0,7), ALSA (2 in, 0 out)
   5 sof-hda-dsp: - (hw:0,31), ALSA (0 in, 2 out)
   6 sysdefault, ALSA (128 in, 128 out)
... etc etc etc

From SC it prints… nothing. Pipe gets… nothing.

p = Pipe("/home/xxx/share/SC/scd/...path_redacted.../py-get-devices.sh", "r");
p.isOpen;  // true
p.getLine;  // nil :-x
p.close;

Why?

hjh

Realized later that it must be a difference in the system environment variables between an interactive shell session and sclang. Then I saw in the plp repository sources that this source command can only run in a shell.

So I opened a new shell and listed all the environment variables. Then, applied the source changes and listed them all again. An Emacs ediff-buffers session later, and I had 4 variables that had changed.

So… 1/ run those 4 setenv calls in sclang; 2/ remove the source line from the shell script. 3/ Try the Pipe again in sclang and … got the stdout text.

Posting for posterity – initially a quite confusing situation.

hjh

PS I might post the full result later. The math involved is definitely a pretty gross hack though; I’ve doubts about airing laundry that’s this dirty lol