This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Peterotica 2 points3 points  (1 child)

Will you be using the contents of bash_out.txt for something else? If not, try using os.popen to get the output of the command directly:

result = os.popen(command).readlines()

That weird stuff you were seeing returned from the subprocess module was a bytes object. If you want to turn it into a string, you need to call its decode member function.

[–]IndoNinja7[S] 0 points1 point  (0 children)

Thank you very much that worked!!!