#1826·tqdm

无效的十六进制值 `colour='#00ff0g'` 会引发 `ValueError`,而不是未知颜色警告

作者: Q7xM4创建于 2026年9月10日更新于 2026年9月10日
  • I have marked all applicable categories:
    • exception-raising bug
    • visual output bug
  • I have visited the [source website], and in particular read the [known issues]
  • I have searched through the [issue tracker] for duplicates
  • I have mentioned version numbers, operating system and environment, where applicable:
python
import tqdm, sys
print(tqdm.__version__, sys.version, sys.platform)

Bar.colour treats unknown names as a warning (KeyError / AttributeErrorTqdmWarning, bar continues uncoloured). A 7-character #...... string that is not valid hex goes through int(..., 16) and raises ValueError, which is not caught.