I was wondering if there is a way to dynamically change a subprocess call. Right now I'm running into a problem where I can only input a static string into a subprocess call for google colab and no way to input a string variable.
Here is an example of what I'm trying to do:
for file in list_of_files:
cflow_data = !cflow file
and I am struggling to find a way to get that dynamic string value to be outputted to the subprocess call in google colab. I've tried a variety of methods including:
- subprocess.Popen() followed by .communicate()
- os.system()
- subprocess.call()
and to no avail. If anyone has any insight into this or if it is even possible in Goolge Colab that would be great. Thanks!
After trying more methods I found a solution.
Which takes the system output and converts it to a byte string and then converts that byte string to a string