New submission from Mattia Verga :
I'm trying to assign a file object to a variable and then pass this variable to
configparse.read_file(), but for some reason that doesn't work:
>>> import configparser
>>> config = configparser.ConfigParser()
>>> config.read_file(open('review-stats.cfg'))
>>> config.sections()
['global']
>>>
>>> config2 = configparser.ConfigParser()
>>> f = open('review-stats.cfg')
>>> f
<_io.TextIOWrapper name='review-stats.cfg' mode='r' encoding='UTF-8'>
>>> config2.read_file(f)
>>> config2.sections()
[]
Shouldn't those results be the same?
--
components: Library (Lib)
messages: 360257
nosy: Mattia Verga
priority: normal
severity: normal
status: open
title: configparser read_file() with variable
type: behavior
versions: Python 3.7
___
Python tracker
<https://bugs.python.org/issue39387>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com