我尝试使用以下代码创建一个进度条来查看文件传输的进度。
from tqdm import tqdm
import pysftp
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
srv = pysftp.Connection(host=host,username=username,password=password,cnopts=cnopts)
with tqdm(unit = 'blocks', unit_scale = True, leave = False, miniters = 1, desc = 'Uploading......', total = filesize) as tqdm_instance:
srv.put("D:\\wp-deploy.jpg","/var/www/html/wp-deploy.jpg",callback=lambda sent:tqdm_instance.update(len(sent)))
我得到了这个错误:
TypeError: <lambda>() takes 1 positional argument but 2 were given