-
Notifications
You must be signed in to change notification settings - Fork 123
Closed
Labels
pendingNot looking at it yetNot looking at it yet
Description
Hello,
I was just using this library and noticed when dumping to stdout by using the "-" option there is the following error:
[2020-09-11 08:16:42,305] options -> {}
[2020-09-11 08:16:42,317] Transferred 31 bytes
[2020-09-11 08:16:42,318] Set remote port for session to 1136
[2020-09-11 08:16:42,318] Received DAT from server
[2020-09-11 08:16:42,318] Handling DAT packet - block 1
[2020-09-11 08:16:42,318] Sending ack to block 1
Traceback (most recent call last):
File "/root/.local/bin/tftpy_client.py", line 136, in <module>
main()
File "/root/.local/bin/tftpy_client.py", line 120, in main
tclient.download(options.download,
File "/root/.local/lib/python3.8/site-packages/tftpy/TftpClient.py", line 58, in download
self.context.start()
File "/root/.local/lib/python3.8/site-packages/tftpy/TftpContexts.py", line 402, in start
self.cycle()
File "/root/.local/lib/python3.8/site-packages/tftpy/TftpContexts.py", line 202, in cycle
self.state = self.state.handle(recvpkt, raddress, rport)
File "/root/.local/lib/python3.8/site-packages/tftpy/TftpStates.py", line 586, in handle
return self.handleDat(pkt)
File "/root/.local/lib/python3.8/site-packages/tftpy/TftpStates.py", line 182, in handleDat
self.context.fileobj.write(pkt.data)
TypeError: write() argument must be str, not bytes
It appears to be caused by the following line
Line 367 in af2f2fe
self.fileobj = sys.stdout |
Probably it should be updated to:
self.fileobj = sys.stdout.buffer
I suspect the same issue applies to the input:
Line 284 in af2f2fe
self.fileobj = sys.stdin |
i.e. it should be updated to:
self.fileobj = sys.stdin.buffer
If you like, I can submit a PR to fix this?
Metadata
Metadata
Assignees
Labels
pendingNot looking at it yetNot looking at it yet