TypeError when using Input script
GoogleCodeExporter opened this issue · 3 comments
What steps will reproduce the problem?
1. Run PSSH with -I < script.sh
2. See error
What is the expected output? What do you see instead?
Expect it to run the script provided. Instead it stops with a traceback.
Traceback (most recent call last):
File "/usr/bin/pssh", line 118, in <module>
do_pssh(hosts, cmdline, opts)
File "/usr/bin/pssh", line 89, in do_pssh
statuses = manager.run()
File "/usr/lib/python3.4/site-packages/psshlib/manager.py", line 74, in run
self.iomap.poll(wait)
File "/usr/lib/python3.4/site-packages/psshlib/manager.py", line 255, in poll
handler(fd, self)
File "/usr/lib/python3.4/site-packages/psshlib/task.py", line 170, in handle_stdin
self.byteswritten = start + os.write(fd, chunk)
TypeError: 'str' does not support the buffer interface
What version of the product are you using? On what operating system?
PSSH 2.3.1
Python 3.4.3
Arch Linux
Please provide any additional information below.
Works fine on a CentOS host where Python2 is the default.
Original issue reported on code.google.com by austinab...@gmail.com
on 28 Jun 2015 at 3:23
I had this problem too, maybe related to python 3. I applied this patch:
krig/parallel-ssh@17d96eb
and it seems resolved
For anyone who may run into this issue - I got a very similar message with a TypeError. Searched for a bit but could not find a solution anywhere so I edited my local version of pssh on MacOS Catalina 10.15.5.
In the file psshlib/task.py - line 170 :
change - self.byteswritten = start + os.write(fd, chunk)
to self.byteswritten = start + os.write(fd, str.encode(chunk))
This resolved my problem immediately when reading input from a script.
This should have been fixed. If not, please open a new issue. Make sure you are using the one from this repo.