Hi All,
Am getting the following error, while writing a string to process using write method in python 3, and it works very well for python 2.
I have googled it and found encode() and decode. When I encode the string to utf-8 while writing, it executes without an error, however the output returns is not as expected (not as python 2 output).
This is my code snippet
process.stdin.write('exit\n')
getting the following error
File "test5.py", line 8, in <module>
process.stdin.write('exit\n'))
TypeError: a bytes-like object is required, not 'str'
Could any one please suggest/help me out to solve this issue, would be much appreciated. Thank you.
Regards,
Maiya
Am getting the following error, while writing a string to process using write method in python 3, and it works very well for python 2.
I have googled it and found encode() and decode. When I encode the string to utf-8 while writing, it executes without an error, however the output returns is not as expected (not as python 2 output).
This is my code snippet
process.stdin.write('exit\n')
getting the following error
File "test5.py", line 8, in <module>
process.stdin.write('exit\n'))
TypeError: a bytes-like object is required, not 'str'
Could any one please suggest/help me out to solve this issue, would be much appreciated. Thank you.
Regards,
Maiya