当前位置:网站首页>Pit record: typeerror:'module'object is not callable
Pit record: typeerror:'module'object is not callable
2022-07-24 23:43:00 【GIS and climate】
I encountered the following error when rewriting the code today :

TypeError: 'module' object is not callable
At first, I searched for it for a long time , The code is correct :
pbar = tqdm(enumerate(train_loader), total=len(train_loader), desc='Train ')
It's a very simple sentence .
later debug For a long time , See reference link 【1】 It seems that I just found something , It turns out that the import method is wrong :
import tqdm
But in fact, if you import in the above way , You need to use tqdm function :
pbar = tqdm.tqdm(enumerate(train_loader), total=len(train_loader), desc='Train ')
But it's inconvenient to write a few more letters , Just change to the following import method :
from tqdm import tqdm
Why? ?
If you use import tqdm Just import tqdm This module , We use the function , It just happens that the function name is the same as the module name . And this function is not the only function in this module !

Experience
Be standardized when importing packages ; The functions in the package should be standardized !
Reference resources
【1】https://blog.csdn.net/qq_36396104/article/details/82812461
边栏推荐
- Salesforce zero foundation learning (116) workflow - & gt; On flow
- QT6 with vs Code: compiling source code and basic configuration
- 指针与数组
- 91. (leaflet chapter) leaflet situation plotting - offensive direction drawing
- Code coverage
- Network Security Learning (V) DHCP
- In pgplsql: = and=
- Cross entropy loss
- 中金证券新客理财产品收益可以达到百分之六?开户怎么开?
- 如何创建和管理自定义的配置信息
猜你喜欢

Zheng Huijuan: Research on application scenarios and evaluation methods of data assets based on the unified market

ShardingSphere-数据库分库分表简介

Introduction to HLS programming

谢振东:公共交通行业数字化转型升级的探索与实践

Notes of Teacher Li Hongyi's 2020 in-depth learning series 9

JS ------ Chapter II JS logic control

Go基础笔记_4_map

做一个文艺的测试/开发程序员,慢慢改变自己......

How painful is it to write unit tests? Can you do it

Architecture design of multi live shopping mall
随机推荐
Is it safe for Guosen Securities to open a mobile account
Opengauss kernel analysis: query rewriting
Convert a string to an integer and don't double it
[brother hero July training] day 20: search Binary Tree
ASP. Net core 6.0 data validation based on model validation
认识复杂度和简单排序运算
yolov5
Network Security Learning (V) DHCP
Paper notes: accurate causal influence on discrete data
JS ------ Chapter 5 functions and events
Routing policy in republishing
Value driven provides the core driving force for the transformation of commercial BP - BP realization under business scenarios - Commercial BP sharing
新手哪个证券开户最好 开户最安全
QT6 with vs Code: compiling source code and basic configuration
Js----- Chapter 4 array
Old Du servlet JSP
What are the meanings and application scenarios of the three giants of cloud computing: IAAs, PAAS and SaaS?
Go基础笔记_4_map
NVIDIA inspector detailed instructions
The new version of SSM video tutorial in shangsilicon valley was released