How can I get subprocess.check_call to give me the original binary output of the command, it seems to be encoding incorrectly somewhere.
More details:
I have a command that returns text as follows:
some output text "quote" ...
(These quotes are unicode e2809d)
This is how I invoke the command:
f_output = SpooledTemporaryFile() subprocess.check_call(cmd, shell=True, stdout=f_output) f_output.seek(0) output = f_output.read()
The problem is that I get the following:
>>> repr(output) some output text ?quote? ... >>> type(output) <str>
(And if I call 'ord' '?', I get 63.) I'm on Python 2.7 on Linux.
Note. Running the same code on OSX works correctly for me. The problem is that I am running it on a Linux server.
source share