Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress warnings when using addTree #593

Closed
projectbtle opened this issue Sep 25, 2019 · 3 comments
Closed

Suppress warnings when using addTree #593

projectbtle opened this issue Sep 25, 2019 · 3 comments
Labels
bug platform multi-platform issue wontfix

Comments

@projectbtle
Copy link

projectbtle commented Sep 25, 2019

Bug Report


Warnings are logged to console even when appJar's log level is set to CRITICAL, when using addTree.

Context


I am trying to create a tree from an XML file using addTree. The tree creation works fine (great new addition, by the way!), but warning messages are logged to the console, despite the log level being set to CRITICAL.

Expected Behaviour


No warning messages when log level is set to CRITICAL.

Actual Behaviour


The following warning messages are logged:

Warning: config.IdleConf.GetThemeDict -
 problem retrieving theme element 'context-foreground'
 from theme 'DarkTheme'.
 returning default color: '#000000'

 Warning: config.IdleConf.GetThemeDict -
 problem retrieving theme element 'context-background'
 from theme 'DarkTheme'.
 returning default color: '#ffffff'

I tried suppressing appJar's logging using logging.getLogger('appJar').setLevel(logging.CRITICAL) , which suppresses all other messages from appJar, but not the warnings above. I suspect they are generated by an external library (idlelib?).

Any error messages produced by appJar


The warning messages above.

Sample code, demonstrating the issue


app = gui()
tree = """
<test>
    <test1 />
</test>
"""
app.addTree(
    'MyTree',
    tree,
    rowspan = 1
)
app.go()

What steps are needed to reproduce the bug


Run the above code as a standalone script.

Version Information


appJar: 0.94.0 Python: 3.7.3 TCL: 8.6, TK: 8.6 Platform: Windows

@jarvisteach
Copy link
Owner

Have had a quick look - this is generated by config.py which is part of idlelib, see here line 230.

I don't get these errors on Mac, and hadn't seen them before on Windows - so I guess they are new theme colours being requested, that aren't in the theme dictionary...

I guess an issue could be raised on idlelib, but I'm not sure how else to prevent it?

@projectbtle
Copy link
Author

projectbtle commented Sep 27, 2019

Right now I'm doing the following:

import io
from contextlib import redirect_stderr

f = io.StringIO()
with redirect_stderr(f):
    app.addTree(
        'MyTree',
        tree,
        rowspan=1
    )
f = None

This suppresses the warnings, but isn't a particularly elegant solution.

jarvisteach added a commit that referenced this issue Sep 28, 2019
@jarvisteach jarvisteach added the platform multi-platform issue label Sep 28, 2019
jarvisteach added a commit that referenced this issue Sep 28, 2019
@jarvisteach
Copy link
Owner

I've put a note on the appJar limitations page

But, don't think I'll make any changes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform multi-platform issue wontfix
Projects
None yet
Development

No branches or pull requests

2 participants