setting ExtendedInterpolation as ConfigParser() argument causes TypeError

Issue #9 invalid
Former user created an issue

When setting up the ConfigParser to use ExtendedInterpolation an TypeError is raised.

config = ConfigParser(interpolation=ExtendedInterpolation)'my_config_file.cfg')

File "/usr/lib/python2.7/site-packages/configparser-3.5.0b2-py2.7.egg/backports/configparser/", line 1146
in _join_multiline_values
name, val)
TypeError: unbound method before_read() must be called with BasicInterpolation instance as first argument (got ConfigParser instance instead)

method signature is: def before_read(self, parser, section, option, value): ...
but parser is not given in line 1144/1146
options[name] = self._interpolation.before_read(self, section, name, val)

Comments (3)

  1. Łukasz Langa repo owner

    As the documentation states, you should pass an instantiated interpolation provider to ConfigParser(). In other words, do this (note the extra parens):

    config = ConfigParser(interpolation=ExtendedInterpolation())
  2. Log in to comment