[issue45349] configparser.ConfigParser: 2 newlines at end of file (EOF)

2021-10-02 Thread Martin Panter


Martin Panter  added the comment:

Looks like the same as Issue 32917. I presume there are two newlines at the end 
of the file because there are two newlines following every config section.

IMO this is a minor cosmetic annoyance, just like writing a key with an empty 
value gets you a trailing space after the equals sign at the end of the line. 
Not worth changing as a bug fix, and not worth a special option, but maybe okay 
to change if the code is simple and it doesn't harm compatibility.

--
nosy: +martin.panter
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> ConfigParser writes a superfluous final blank line

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45349] configparser.ConfigParser: 2 newlines at end of file (EOF)

2021-10-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

Please provide code that we can run that shows the problem.

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45349] configparser.ConfigParser: 2 newlines at end of file (EOF)

2021-10-02 Thread Boštjan Mejak

New submission from Boštjan Mejak :

In every Python version that I've tested, writing a config.ini file (utilizing 
configparser.ConfigParser), the result is such that the config.ini file has 2 
newlines at the end of the file.

The problem is that source code editors like Sublime Text, or IDEs like 
PyCharm, already insert a newline at the end of a file, but then 
configparser.ConfigParser 
(or maybe the Python's write() function?)  insert its own as well.

Is it possible to fix this behavior?

--
components: Library (Lib)
messages: 403069
nosy: PythonEnthusiast
priority: normal
severity: normal
status: open
title: configparser.ConfigParser: 2 newlines at end of file (EOF)
type: behavior
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com