Can't concat bytes to str
subprocess.check_output()
returns a bytestring.
In Python 3, there's no implicit conversion between unicode (str
) objects and bytes
objects. If you know the encoding of the output, you can .decode()
it to get a string, or you can turn the \n
you want to add to bytes
with "\n".encode('ascii')
subprocess.check_output() returns bytes.
so you need to convert '\n' to bytes as well:
f.write (plaintext + b'\n')
hope this helps