wx.FileConfig error when INI file has duplicate section names

I’m trying to use wx.FileConfig to manage my application settings, but it throws a PyAssertionError if the file has duplicate section names.
Is there any way around this? I’d hate to switch to a third-party INI file manager at this point.

Test Script:
import os
import wx
app = wx.App(False)
config = wx.FileConfig(localFilename=os.getcwd()+os.sep+“PROGRAM.INI”)

PROGRAM.INI:
[APP]
enableLog=1
[APP]
enableLog=0

Result (wxPython 2.8 and 3.0):
Traceback (most recent call last):
File “”, line 1, in
File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_misc.py”, line 3514, in init
misc.FileConfig_swiginit(self,misc.new_FileConfig(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion “!m_pParent || !m_pLine || !pLine” failed at …\src\common\fileconf.cpp(1381) in wxFileConfigGroup::SetLine(): changing line for a non-root group?

I'm trying to use wx.FileConfig to manage my application settings, but it
throws a PyAssertionError if the file has duplicate section names.
Is there any way around this? I'd hate to switch to a third-party INI file
manager at this point.

Test Script:
import os
import wx
app = wx.App(False)
config = wx.FileConfig(localFilename=os.getcwd()+os.sep+"PROGRAM.INI")

PROGRAM.INI:
[APP]
enableLog=1
[APP]
enableLog=0

How did you create such a tree?
Is it made with the wx.FileConfig or made by hand?

Thank you.

···

On Tue, Jun 27, 2017 at 2:05 PM, cbeytas <cbeytas@hotmail.com> wrote:

Result (wxPython 2.8 and 3.0):
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_misc.py", line 3514, in
__init__
    _misc_.FileConfig_swiginit(self,_misc_.new_FileConfig(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "!m_pParent || !m_pLine || !pLine"
failed at ..\..\src\common\fileconf.cpp(1381) in
wxFileConfigGroup::SetLine(): changing line for a non-root group?

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

It was made by hand as an example.

···

On Tuesday, 27 June 2017 14:15:46 UTC-4, Igor Korot wrote:

How did you create such a tree?

Is it made with the wx.FileConfig or made by hand?

Thank you.

It was made by hand as an example.

This will never happen in real-life application.
And the assertion indicate that there is something wrong.

There is no problem/bug here unless you can generate this type of
INI file programmatically.

Thank you.
.

···

On Tue, Jun 27, 2017 at 2:42 PM, cbeytas <cbeytas@hotmail.com> wrote:

On Tuesday, 27 June 2017 14:15:46 UTC-4, Igor Korot wrote:

How did you create such a tree?
Is it made with the wx.FileConfig or made by hand?

Thank you.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thank you for your opinion. I’m disappointed that wx.FileConfig isn’t able to tolerate duplicate sections (even systemd can do this).
It would be acceptable to stop parsing at that point, but throwing an assertion error means there is no easy workaround.

···

On Tuesday, 27 June 2017 14:52:05 UTC-4, Igor Korot wrote:

On Tue, Jun 27, 2017 at 2:42 PM, cbeytas cbe...@hotmail.com wrote:

It was made by hand as an example.

This will never happen in real-life application.

And the assertion indicate that there is something wrong.

There is no problem/bug here unless you can generate this type of

INI file programmatically.

Thank you.

.

On Tuesday, 27 June 2017 14:15:46 UTC-4, Igor Korot wrote:

How did you create such a tree?

Is it made with the wx.FileConfig or made by hand?

Thank you.

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.