wx.FileConfig error when INI file has duplicate section names

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

wx.FileConfig error when INI file has duplicate section names

cblot
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 "<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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.FileConfig error when INI file has duplicate section names

Igor Korot
On Tue, Jun 27, 2017 at 2:05 PM, cbeytas <[hidden email]> wrote:

> 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.

>
> 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 [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.FileConfig error when INI file has duplicate section names

cblot
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.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.FileConfig error when INI file has duplicate section names

Igor Korot
On Tue, Jun 27, 2017 at 2:42 PM, cbeytas <[hidden email]> 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 [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.FileConfig error when INI file has duplicate section names

cblot
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="qvrrX0SLAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">cbe...@...> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="qvrrX0SLAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">wxpython-user...@googlegroups.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...