I have this piece of code that works in Python on my Raspberry Pi:
a1 = "arecord --device=hw:0,0 --format S16_LE --rate 44100 -c1 test.wav"
proc = subprocess.Popen(a1.split())
time.sleep(5)
proc.kill()
When this executes, the USB sound card I have starts to record audio, and then stops after 5 seconds. But I am trying to execute another command line command using the same format, and it doesn't work:
a2 = "rm -f Test/*"
delete_contents = subprocess.Popen(a2.split())
I am trying to call this to delete everything within my Test folder, and it works when I type the command in the command prompt, but will not delete when I call it from my Python program.