[issue29623] configparser.ConfigParser.read() does not accept Pathlib path as a single argument.

David Ellis report at bugs.python.org
Wed Feb 22 13:48:55 EST 2017


New submission from David Ellis:

Trying to use configparser.ConfigParser.read on a pathlib object results in a TypeError. If supplied in a list it works as expected.

Repro:
    >>> import pathlib, configparser
    >>> configparser.ConfigParser().read(pathlib.Path('some.ini'))

    TypeError: 'PosixPath' object is not iterable

The issue appears to be line 690 which checks for str before attempting to iterate and doesn't check for os.PathLike (or bytes?).

This was actually mentioned as an example where pathlib did not work here: https://bugs.python.org/issue22570

----------
components: Library (Lib)
messages: 288378
nosy: David Ellis
priority: normal
severity: normal
status: open
title: configparser.ConfigParser.read() does not accept Pathlib path as a single argument.
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29623>
_______________________________________


More information about the Python-bugs-list mailing list