Title: Misleading error when initing ImportError
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.6, Python 3.4, Python 3.5
Status: closed Resolution: duplicate
Dependencies: Superseder: Misleading error message when ImportError called with invalid keyword args
View: 21578
Assigned To: Nosy List: Sebastian Kreft, berker.peksag, brett.cannon
Priority: normal Keywords:

Created on 2015-09-16 14:48 by Sebastian Kreft, last changed 2015-09-16 17:20 by berker.peksag. This issue is now closed.

Messages (3)
msg250850 - (view) Author: Sebastian Kreft (Sebastian Kreft) Date: 2015-09-16 14:48
ImportError now supports the keyword arguments name and path. However, when passing invalid keyword arguments, the reported error is misleading, as shown below.

In [1]: ImportError('lib', name='lib')
Out[1]: ImportError('lib')

In [2]: ImportError('lib', name='lib', foo='foo')
TypeError                                 Traceback (most recent call last)
<ipython-input-2-5af12651187f> in <module>()
----> 1 ImportError('lib', name='lib', foo='foo')

TypeError: ImportError does not take keyword arguments
msg250854 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-09-16 16:34
I bet it's because of which is called by .
msg250856 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-09-16 17:20
Thanks for the report. This is a duplicate of issue 21578.
Date User Action Args
2015-09-16 17:20:42berker.peksagsetstatus: open -> closed

superseder: Misleading error message when ImportError called with invalid keyword args

nosy: + berker.peksag
messages: + msg250856
resolution: duplicate
stage: resolved
2015-09-16 16:34:35brett.cannonsetnosy: + brett.cannon
messages: + msg250854

components: + Interpreter Core
type: enhancement
2015-09-16 14:48:47Sebastian Kreftcreate