1

We have a Python process to SFTP files to various customers. A normal put with pysftp will also do a stat to confirm file size. We have one customer where we must skip this stat check with parameter confirm=false. If we do not skip this check, we receive a {path}\{file} is not a valid path error.

We believed this is due to the customer moving the file too quickly for the stat check to find it. We came to this conclusion after referencing the follow SO post:

Python pysftp.put raises "No such file" exception although file is uploaded

In that post, the user claims that even when the stat check fails, the files do get transferred. Also, of course, our error messages differ. However, our customer never receives the files in these cases. This seems to mean the files never transferred in the first place. Thus, the server did not move files too quickly for stat check to cause a failure and something else is going on with the transfer. I'm not sure what though, as disabling stat check causes the transfer to succeed every time we get this issue.

What could the cause of this issue be?

  • That's probably not a programming problem. If `put` did not throw any exception, it means the server acknowledged the transfer. Anything that happens with the file afterwards it not your concern (as long as you delivered the file to the correct remote folder). – Martin Prikryl Sep 13 '22 at 17:34

0 Answers0