0

I am using Raspberry Pi to record audio. I tried pyaudio but it didn't work, then I tried to use the subprocess module. As the recording needs to be executed multiple times, I need to make sure that the recoding filename is different after every recording.

For example, I would like to:

filename = datetime.now().strftime("%Y-%m-%d_%H_%M_%S")+".wav"

My question is: can I pass this filename as an argument to subprocess? I checked the document, it says only string and list are supported as arguments in subprocess.

1
  • 1
    Well, isn't a filename a string? Commented Nov 6, 2017 at 10:16

1 Answer 1

1

This filename is a string. So nothing prevents it from being used as one of the strings in subprocess.

Take care to use the list of strings variant with shell=False (the default) and the string variant with shell=True. Then everything should work as needed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.