This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: from . import bug
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: gangesmaster, georg.brandl, nnorwitz, twouters
Priority: critical Keywords:

Created on 2006-09-02 09:05 by gangesmaster, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
import-exceptions.diff georg.brandl, 2006-09-03 07:10
Messages (7)
msg29736 - (view) Author: ganges master (gangesmaster) Date: 2006-09-02 09:05
>>> from . import foo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Relative importpath too deep

it should raise ImportError, as the module does not exist.
there's nothing wrong with the path being too deep.

msg29737 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-09-02 09:21
Logged In: YES 
user_id=849994

Agreed. Can we fix this for 2.5?
msg29738 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-09-02 18:49
Logged In: YES 
user_id=33168

Can you provide a patch to fix it?  I'll make a decision
partly based on the patch.
msg29739 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-09-03 07:10
Logged In: YES 
user_id=849994

See attached patch.

I couldn't find a mention of this ValueError in the PEP or
the docs, so changing it to ImportError and giving better
error messages looks like the way to go.
msg29740 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-09-05 01:26
Logged In: YES 
user_id=33168

Thomas, could you take a look at this patch.  I'm not sure
it's correct.  I thought you had some reasons for these
ValueErrors (unless it was diff code).
msg29741 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2006-09-05 14:14
Logged In: YES 
user_id=34209

I prefer ValueError over ImportError as the problem is in
the code doing the import, not in a missing module. I don't
have a strong feeling either way, though. The new messages
seem better.
msg29742 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-09-06 06:09
Logged In: YES 
user_id=849994

Agreed. Only changed the messages in rev. 51765, 51766 (2.5).
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43929
2006-09-02 09:05:09gangesmastercreate