0

I am using python 3's module tftpy to attempt to handle tftp style downloading of a file. However, when I run the application I get the following error:

\Python38\site-packages\tftpy\TftpStates.py", line 53, in handleOACK
    raise TftpException("No options found in OACK")
tftpy.TftpShared.TftpException: No options found in OACK

How do I get my python project to ignore OACK/ send a new request packet that doesn't include an OACK?

Disclaimer: This is my first time attempting to work with TFTP packets so I am fairly new. If the question I posed isn't the appropriate way to handle it, what should I be doing?

MORE DATA ON THE PROBLEM:

  1. I am using an external chip that is programmed to ignore OACK packet options.
  2. When I used C# and the TFTP.Net package the transfer worked, so I don't believe it is an issue with my TFTP server. However, as our main application is based in python I want to be able to handle this communication via python 3.
  3. I am running python 3.8.5
  4. On my server side it is saying it receives a packet with error code 8.

python Script:

import tftpy


client = tftpy.TftpClient('192.168.0.42', 69)
client.download('triplog.txt', 'faultlog.txt', packethook=None, timeout=5)

full traceback:

Failed to negotiate options: No options found in OACK
Traceback (most recent call last):
  File "C:\Users\selena\Documents\PythonScripts\TFTP\TFTPTestScript.py", line 23, in <module>
    client.download('triplog.txt', 'faultlog.txt', packethook=None, timeout=5)
  File "C:\Users\selena\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tftpy\TftpClient.py", line 58, in download
    self.context.start()
  File "C:\Users\selena\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tftpy\TftpContexts.py", line 402, in start
    self.cycle()
  File "C:\Users\selena\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tftpy\TftpContexts.py", line 202, in cycle
    self.state = self.state.handle(recvpkt, raddress, rport)
  File "C:\Users\selena\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tftpy\TftpStates.py", line 566, in handle
    self.handleOACK(pkt)
  File "C:\Users\selena\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tftpy\TftpStates.py", line 53, in handleOACK
    raise TftpException("No options found in OACK")
tftpy.TftpShared.TftpException: No options found in OACK
[Finished in 0.7s with exit code 1]
Selena
  • 1
  • 2
  • Is that the full traceback you've provided? – ewokx Sep 01 '20 at 00:16
  • @ewong thanks for the catch, I've added the full traceback and a note about the error packet my server then receives to the original post. – Selena Sep 01 '20 at 14:17
  • been looking at the tftp code and it seems as if tftp expects options to be set in ```client = tftp.TftpClient..``` line. Try ```client = tftp.TftpClient('192.168.0.42', 69, options={'blksize': 8})``` this might be an issue in the code.. try filing an issue @ https://github.com/msoulier/tftpy – ewokx Sep 02 '20 at 00:52

1 Answers1

0

Credit @ewong for this workaround solution

The code worked after adding in options when initializing the client even though I didn't need them. I'll be filing an issue @https://github.com/msoulier/tftpy to see if this is a bug that needs to be addressed or a deliberate choice.

Solution code:

import tftpy


client = tftpy.TftpClient('192.168.0.42', 69, options={'blksize': 8})
client.download('triplog.txt', 'faultlog.txt', packethook=None, timeout=5)
Selena
  • 1
  • 2