我遇到了一个问题,当我尝试在Python 3.2.2中执行此代码时,会出现错误。
working_file = subprocess.Popen(["/pyRoot/iAmAProgram"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
working_file.stdin.write('message')
我知道Python 3改变了它处理字符串的方式,但我不知道如何格式化“message”。 有人知道我该如何更改此代码才能使其有效吗?感谢大家。更新:这是我收到的错误信息。
Traceback (most recent call last):
File "/pyRoot/goRender.py", line 18, in <module>
working_file.stdin.write('3')
TypeError: 'str' does not support the buffer interface