Please help me to upload a file to a TFTP server using python. I'm using tftpy module. In the document(http://tftpy.sourceforge.net/sphinx/index.html) it says
class tftpy.TftpClient.TftpClient(host, port, options={})
upload(filename, input, packethook=None, timeout=5)
what should be the filename- is it a path of the remote server where the file already existing or is it just new file name which server will create using the filename in the default directory or path for the new file (filename) to create ?
Do I have to have to create a file of same name as input file in the server before upload?
What is the default directory the server will upload files to?
If so, what is the other way for the server to create a file using the name passed (filename)?
What I'm sending is
tftp_obj.upload('something.txt','/home/username/project/example.txt')
I'm sending the new file name something.txt which doesn't exist in the server I'm getting the error message:
raise TftpException, "Received ERR from server: " + str(pkt)
tftpy.TftpShared.TftpException: Received ERR from server: ERR packet: errorcode = 1
msg = File not found
I get the same error if I create the file (same as input file name) in the remote server under root (/example.txt) (assuming the default folder it uploads to is root) and give path for filename parameter
tftp_obj.upload('/example.txt','/home/username/project/example.txt')
Same error when I pass just the existing file name
tftp_obj.upload('example.txt','/home/username/project/example.txt')
Please help with examples.