Tôi đang gặp một vấn đề mà tôi nhận được lỗi khi tôi cố gắng để thực thi mã này với python 3.2.2chuỗi định dạng cho stdin.write() trong python 3.x
working_file = subprocess.Popen(["/pyRoot/iAmAProgram"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
working_file.stdin.write('message')
Tôi hiểu rằng python 3 thay đổi cách nó xử lý chuỗi nhưng tôi không hiểu làm thế nào để định dạng 'tin nhắn'. Có ai biết làm thế nào tôi muốn thay đổi mã này để có giá trị?
cảm ơn nhiều
jon
update: heres được thông báo lỗi tôi nhận được
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
Bạn quên thông báo lỗi. –