[issue39387] configparser read_file() with variable

2020-01-19 Thread Mattia Verga


Mattia Verga  added the comment:

I started trying to reproduce this with different Python interpreters and I've 
found it now works as expected also with the original one (BTW it was CPython 
3.7.6).
I really don't know why it didn't work before. Sorry for the noise.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
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



[issue39387] configparser read_file() with variable

2020-01-19 Thread Mattia Verga


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