[issue31535] configparser unable to write comment with a upper cas letter

2018-09-26 Thread Philippe Wagnieres

Philippe Wagnieres  added the comment:

Thank for your support.

Sorry I have no time to give you an answer and work on with Python, but 
I have understand the solution.

Best Regards

Philippe Wagnières
Chalamont 6
1400 Yverdon-les-Bains
Suisse
tel.: +41 76 367 27 43

Le 24.09.2018 à 17:42, Karthikeyan Singaravelan a écrit :
> Karthikeyan Singaravelan  added the comment:
>
> All config options including comment are converted to lowercase when they are 
> stored. You can customize this behavior using 
> https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.optionxform
>  . You can also refer to 
> https://docs.python.org/3/library/configparser.html#customizing-parser-behaviour
>  for more customization. I am closing this as not a bug as part of triaging. 
> Feel free to reopen this if needed.
>
> Thanks for the report Philippe!
>
> --
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue31535] configparser unable to write comment with a upper cas letter

2018-09-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

All config options including comment are converted to lowercase when they are 
stored. You can customize this behavior using 
https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.optionxform
 . You can also refer to 
https://docs.python.org/3/library/configparser.html#customizing-parser-behaviour
 for more customization. I am closing this as not a bug as part of triaging. 
Feel free to reopen this if needed.

Thanks for the report Philippe!

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

___
Python tracker 

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



[issue31535] configparser unable to write comment with a upper cas letter

2018-09-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Ah my bad again. The config.optionxform = str does the trick. I was using an 
older object.

from configparser import ConfigParser

config = ConfigParser(allow_no_value=True)
config.optionxform = str
config.add_section('default_settings')
config.set('default_settings', '; comment HERE')

with open('example_case.ini', 'w') as configfile: config.write(configfile)
with open('example_case.ini', 'r') as configfile: print(configfile.read())


Thanks

--

___
Python tracker 

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



[issue31535] configparser unable to write comment with a upper cas letter

2018-09-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Ah sorry, didn't notice it was about comments. It seems config.optionxform = 
str has no effect on comments.

Thanks

--

___
Python tracker 

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



[issue31535] configparser unable to write comment with a upper cas letter

2018-09-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

All config options are converted to lowercase when they are stored. You can 
customise this with 
https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.optionxform.
 You can customize it more with 
https://docs.python.org/3/library/configparser.html#customizing-parser-behaviour

>  Note also that keys in sections are case-insensitive and stored in lowercase 

>>> from configparser import ConfigParser
>>> c = ConfigParser()
>>> c["A"] = {'FOO': 'bar'}
>>> with open('example.ini', 'w') as configfile: c.write(configfile)
...
>>> with open('example.ini', 'r') as configfile: print(configfile.read())
...
[A]
foo = bar


# Don't convert to lower case

>>> d = ConfigParser()
>>> d.optionxform = str
>>> d["A"] = {'FOO': 'bar'}
>>> with open('example_case.ini', 'w') as configfile: d.write(configfile)
...
>>> with open('example_case.ini', 'r') as configfile: print(configfile.read())
...
[A]
FOO = bar


Hope this answers your question. Feel free to close this if it's clear.

Thanks

--

___
Python tracker 

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



[issue31535] configparser unable to write comment with a upper cas letter

2018-09-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue31535] configparser unable to write comment with a upper cas letter

2017-09-20 Thread Philippe Wagnieres

New submission from Philippe Wagnieres:

I create entry with this:

   self.settings.set('General', 'Initial filter', 'All file (*.*)')
   self.settings.set('General', '# 1 => Text files (*.txt)')
   self.settings.set('General', '# 2 => CSV files (*.csv)')
   self.settings.set('General', '# 3 => Text files (*.txt) \n')

and after writing in a file:
   initial filter = All file (*.*)
   ; 1 => text files (*.txt)
   ; 2 => csv files (*.csv)
   # 3 => text files (*.txt) 

(; or # to test if differ)

It is normal or not?

Thank & Best Regards

--
messages: 302633
nosy: philippewagnie...@hispeed.ch
priority: normal
severity: normal
status: open
title: configparser unable to write comment with a upper cas letter
type: enhancement
versions: Python 3.6

___
Python tracker 

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