[issue15767] add ImportNotFoundError

2013-05-28 Thread Brett Cannon
Changes by Brett Cannon : -- assignee: -> brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue15767] add ImportNotFoundError

2013-02-19 Thread Eric Snow
Eric Snow added the comment: Right. Sorry I wasn't more clear. Existing code will continue to work either way. The point is in exposing the distinct module/name-not-found case, which I consider to be the common case for catching ImportError. My examples cover the case where you want to han

[issue15767] add ImportNotFoundError

2013-02-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Why not just try: from _thread import _local as local except ImportError: from _threading_local import local ? -- ___ Python tracker ___

[issue15767] add ImportNotFoundError

2013-02-19 Thread Eric Snow
Eric Snow added the comment: The common case for catching ImportError is exactly what ModuleNotFoundError represents. If people are already going to change their code to handle just this special case, I'd think having the subclass would be the better route. I find it simpler (both to update

[issue15767] add ImportNotFoundError

2013-02-19 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Feb 19, 2013, at 07:49 PM, Brett Cannon wrote: >Serihy & Barry: no. We do that now and it's already a nasty little hack. It >would be better to let people catch an exception signaling that an import >didn't happen because some module is missing than require

[issue15767] add ImportNotFoundError

2013-02-19 Thread Brett Cannon
Brett Cannon added the comment: Chris: Having a more generic name for import-from at the eval loop level on top of NoModuleFoundError is breaking the "practicality over purity" rule. ImportSearchFailed might be the closest we can come to a generic name for what occurred. Serihy & Barry: no. W

[issue15767] add ImportNotFoundError

2013-02-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: > >Can this be the same ImportError but with special flag? > > Like an attribute on the exception? +1 ImportError.has_different_meaning_but_too_lazy_to_create_a_distinct_exception_class_for_it ? (or perhaps you would prefer the camelCase version :-)) --

[issue15767] add ImportNotFoundError

2013-02-19 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Feb 19, 2013, at 07:24 PM, Serhiy Storchaka wrote: >Can this be the same ImportError but with special flag? Like an attribute on the exception? +1 -- ___ Python tracker

[issue15767] add ImportNotFoundError

2013-02-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Can this be the same ImportError but with special flag? -- ___ Python tracker ___ ___ Python-bugs-

[issue15767] add ImportNotFoundError

2013-02-19 Thread Chris Jerdonek
Chris Jerdonek added the comment: If we can promise not to use it in the from-import case :) I'm okay with the more specific name (in fact it is preferable). From Brett's response, it sounds like we have flexibility there and don't need it to be the same? For from-import I would prefer the g

[issue15767] add ImportNotFoundError

2013-02-19 Thread Brett Cannon
Brett Cannon added the comment: Technically it should be ModuleOrSomeObjectNotFoundBecauseFromListIsTheBaneOfMyExistenceError, but we might be starting to mix paints for paints a shed shortly. Fine, that's 1 to 1 for ModuleNotFoundError vs. ImportNotFoundError. -- ___

[issue15767] add ImportNotFoundError

2013-02-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: > The original need was for internal importlib usage, but upon > reflection it could also be used by the eval loop for that > (http://hg.python.org/cpython/file/83d70dd58fef/Python/ceval.c#l4560), > so I'm fine with changing the name to ImportNotFoundError. I do

[issue15767] add ImportNotFoundError

2013-02-19 Thread Brett Cannon
Brett Cannon added the comment: The original need was for internal importlib usage, but upon reflection it could also be used by the eval loop for that (http://hg.python.org/cpython/file/83d70dd58fef/Python/ceval.c#l4560), so I'm fine with changing the name to ImportNotFoundError. --