New submission from Jean Abou Samra <j...@abou-samra.fr>:

See for example:

>>> from pygments.regexopt import regexopt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'regexopt' from 'pygments.regexopt' 
(/home/jean/repos/pygments/pygments/regexopt.py)
>>> from pygments.regexopt import regex_opt
>>> regexopt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'regexopt' is not defined. Did you mean: 'regex_opt'?

In Python 3.10, there is a nice helpful error message suggesting
how to correct the typo for NameError and AttributeError. Would
it be possible to have the same for ImportError with 'from import'?

----------
components: Interpreter Core
messages: 414385
nosy: Jean_Abou_Samra
priority: normal
severity: normal
status: open
title: Typo hint message for from-imports?
type: enhancement
versions: Python 3.10, Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46902>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to