4

I'm using Pysftp to sftp put a large number of files, and would love to get some progress outputs as it runs so I know how it's doing. Is there a verbose option (or equivalent) I can use to get that ouput?

Thanks.

user1902853
  • 399
  • 1
  • 12

1 Answers1

0

I could be incorrectly importing paramiko here as I believe its in pysftp anyway but you should get the jist.

import logging
import paramiko
import pysftp
paramiko.util.log_to_file('log_debug.txt', level = 'DEBUG')
# As far as I can see you can use DEBUG, INFO, WARNING or ERROR here but there's possibly more
with pysftp.Connection([whatever you're doing here normally]) as sftp:
    sftp.put([or whatever you're doing here instead])
with open('log_debug.txt') as logfile:
    log = logfile.read()
print (log)

Obviously you don't have to print it, do what you like...
I've only got this from trying to do something similar, I'm not an expert!

Tim Edwards
  • 1,031
  • 1
  • 13
  • 34