简体   繁体   English

Python tqdm TypeError: <lambda> ()接受1个位置参数,但给出了2个

[英]Python tqdm TypeError: <lambda>() takes 1 positional argument but 2 were given

I tried to create a progress bar to view progress of file transferring by using the below code. 我试图创建一个进度条,以使用以下代码查看文件传输的进度。

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)))

and I got this error: 我得到这个错误:

TypeError: <lambda>() takes 1 positional argument but 2 were given

From the docs : 文档

  • callback ( callable ) – optional callback function (form: func(int, int) ) that accepts the bytes transferred so far and the total bytes to be transferred callbackcallable )–可选的回调函数(形式: func(int, int) ),它接受到目前为止已传输的字节以及要传输的总字节

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “类型错误:<lambda> () 采用 1 个位置参数,但使用 reduce() 给出了 2 个</lambda> - "TypeError: <lambda>() takes 1 positional argument but 2 were given" using reduce() Python3 TypeError:接受1个位置参数,但给定2个 - Python3 TypeError: takes 1 positional argument but 2 were given Python 继承 - 类型错误:__init__() 采用 1 个位置参数,但给出了 4 个 - Python Inheritance - TypeError: __init__() takes 1 positional argument but 4 were given TypeError:method()接受1个位置参数,但给出2个(Python和Kivy) - TypeError: method()takes in 1 positional argument but 2 were given (Python and Kivy) Python Selenium TypeError:__init__() 需要 1 个位置参数,但给出了 2 个 - Python Selenium TypeError: __init__() takes 1 positional argument but 2 were given 类型错误:__init__() 需要 1 个位置参数,但给了 2 个 Python - TypeError: __init__() takes 1 positional argument but 2 were given Python 类型错误:函数需要 1 个位置参数,但 2 个被赋予了 kivy python - TypeError: Function takes 1 positional argument but 2 were given kivy python <lambda>() 接受 1 个位置参数,但给出了 2 个 - <lambda>() takes 1 positional argument but 2 were given TypeError:parse()接受1个位置参数,但给出了6个 - TypeError: parse() takes 1 positional argument but 6 were given 类型错误:需要 1 个位置参数,但给出了 2 个 - TypeError: takes 1 positional argument but 2 were given
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM