【发布时间】:2011-12-13 09:35:07
【问题描述】:
我在尝试使用 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 改变了它处理字符串的方式,但我不明白如何格式化“消息”。有谁知道我将如何更改此代码以使其有效?
非常感谢
乔恩
更新:这是我收到的错误消息
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
【问题讨论】:
-
您忘记了错误信息。
标签: string python-3.x stdin