Claudiu.Popa added the comment:

But the last traceback conveys enough information, the user can see immediately 
that the given section does not exist.
My problem with the current behaviour is that the first error distracts the 
user, while the actual problem is the second traceback.
But I have another example which might contradict my proposal. In the example 
in the second traceback, it's not clear what `Bad value substitution` stands 
for and the first traceback adds the relevant context (the fact that key is 
missing). But I guess this stands for another issue, for enhancing the message 
for InterpolationMissingOptionError to transmit the fact that a given option is 
missing.


Traceback (most recent call last):
  File "C:\Python34\lib\configparser.py", line 410, in _interpolate_some
    v = map[var]
  File "C:\Python34\lib\collections\__init__.py", line 789, in __getitem__
    return self.__missing__(key)            # support subclasses that define 
__missing__
  File "C:\Python34\lib\collections\__init__.py", line 781, in __missing__
    raise KeyError(key)
KeyError: 'home_dir1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\configparser.py", line 1204, in __getitem__
    return self._parser.get(self._name, key)
  File "C:\Python34\lib\configparser.py", line 773, in get
    d)
  File "C:\Python34\lib\configparser.py", line 374, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "C:\Python34\lib\configparser.py", line 413, in _interpolate_some
    option, section, rest, var)
configparser.InterpolationMissingOptionError: Bad value substitution:
        section: [Paths]
        option : my_dir
        key    : home_dir1
        rawval : /lumberjack

----------

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

Reply via email to