Check if SuperCollider does not print errors on the post window.
import subprocess # start sclang to check if file is executable p = subprocess.Popen(['sclang', '/path/to/file.scd'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (output, err) = p.communicate() p_status = p.wait() if p_status == 0: r = re.findall('(ERROR)+', str(output), flags=re.IGNORECASE) if r: print('An ERROR occurred!') else: print('File is executable!')
It is possible to start the scsynth
within sclang
using s.waitForBoot
. In order to stop sclang
and get the post window output in python we have to kill sclang's interpreter using the command 0.exit
.
fork{ s.waitForBoot{ { SinOsc.ar(400 * SinOsc.kr(9), 0, 0.5) }.play; }; 2.wait; 0.exit; }