Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert returned binary data from call() to string
This changes is based on the same cause as commit 6ea4b6f subprocess.check_output() returns binary data as output. In python2, binary is basically an alias of str so it can be directly used as a normal string. However in python3 the binary data is different to a string. Inserting binary data into a string in python3 generates strings like '/some/path/with/b'binary'/data/inserted' which are not correct file paths. We must decode() the returned data in order to use it as a string. This change also explicitly sets encoding="utf-8". In Python2, default decoding is ASCII while in Python 3 it is "utf-8". Leaving encoding parameters as defaults will break non-ASCII output on Python 2.
- Loading branch information