Apr-15-2022, 09:03 PM
(This post was last modified: Apr-15-2022, 09:46 PM by deanhystad.)
Guess this is not related to your problem. But I have seen this using subprocess on Windows:
You are not concatenating strings. You are concatenating bytes and strings. You need to convert the bytes object returned by the subprocess call to a str.
You are not concatenating strings. You are concatenating bytes and strings. You need to convert the bytes object returned by the subprocess call to a str.
Output:>>> v_first_cell_name = subprocess.check_output("TYPE data.csv", shell=True)
>>> print(v_first_cell_name)
b'this_is_a_test' #<- See! This is a bytes object, not str
>>> v_first_cell_name = v_first_cell_name.decode() # <- Convert bytes to str
>>> print(v_first_cell_name)
this_is_a_test #<- Now it is a str. no b''
>>> print("some prefix" + v_first_cell_name + "some suffix")
some prefixthis_is_a_testsome suffix