0

C:\Program Files\Backup>2.py Traceback (most recent call last): File "C:\Program Files\Backup\2. py", line 7, in size = sftp.size(remote_path) NameError: name 'sftp' is not defined

CODE

import os
import paramiko

local_path = "C:\backup"
remote_path = "/backup/db.bak"

size = sftp.size(remote_path)

pbar = ProgressBar(widgets=widgets, maxval=size)
pbar.start()

def file_write(data):
   file.write(data) 
   global pbar
   pbar += len(data)

ftp.retrbinary("RETR " + remote_path, file_write)
gen_Eric
  • 214,658
  • 40
  • 293
  • 332
  • 1
    you need to define `sftp` variable with; see https://stackoverflow.com/questions/3635131/paramikos-sshclient-with-sftp – Bijay Regmi Nov 10 '21 at 16:18

0 Answers0