python - Type Error 'module' is not callable - how to fix?
问题描述
I have checked other questions similar but they are not working. I'm trying to run the following code:
# Create the images
for n in progressbar(range(count)):
# Set image name
image_name = str(n).zfill(zfill_count) + '.png'
# Get a random set of valid traits based on rarity weights
trait_sets, trait_paths = generate_trait_set_from_config()
# Generate the actual image
generate_single_image(trait_paths, os.path.join(op_path, image_name))
# Populate the rarity table with metadata of newly created image
for idx, trait in enumerate(trait_sets):
if trait is not None:
rarity_table[CONFIG[idx]['name']].append(trait[: -1 * len('.png')])
else:
rarity_table[CONFIG[idx]['name']].append('none')**
I'm getting the error over the line "for n in progressbar". I've seen references that maybe I have multiple files named the same but I can't find them.
解决方案
only progressbar2
can be used without a instance
pip uninstall progressbar
pip install progressbar2
sample code
import time
from progressbar import progressbar
for i in progressbar(range(100)):
time.sleep(0.02)
推荐阅读
- ssas - 转置 mdx 结果 => 值丢失
- php - Zoom API 请求创建会议
- php - 按类别区分 Woocommerce 数量输入值
- jenkins - 如果其中一个步骤失败(但管道成功),则在 Jenkins 构建历史记录中用红色图标标记管道
- angular - Fullcalendar (v5) Angular 未在 dayGridMonth 视图中实现事件 backgroundColor
- html - css 中的类不起作用和显示问题
- javascript - 在 node_modules (javascript) 中找不到模块
- javascript - 将 JSON 数据从 Flask 传递到 JavaScript
- awk - awk:根据所选列中的值过滤日志文件
- php - 空白响应没有显示json php的值