Python - No handlers could be found for logger "OpenGL.error"

91,391

Solution 1

Looks like OpenGL is trying to report some error on Win2003, however you've not configured your system where to output logging info.

You can add the following to the beginning of your program and you'll see details of the error in stderr.

import logging
logging.basicConfig()

Checkout documentation on logging module to get more config info, conceptually it's similar to log4J.

Solution 2

The proper way to get rid of this message is to configure NullHandler for the root level logger of your library (OpenGL).

Solution 3

After adding the Logging above, I was able to see that the problem was caused by missing TConstants class, which I was excluding in the py2exe setup.py file.

After removing the "Tconstants" from the excluded list, I no longer had problems.

Share:
91,391

Related videos on Youtube

Paige Watson
Author by

Paige Watson

I am a Solutions Developer and XP evangelist currently working at Premera Blue Cross I espouse that programmers are not a fungible resource, but craft-persons. All of my work is done with TDD and is Pair-Programmed or Mobbed. I regularly talk at companies and conferences on Code Craftsmenship. My interests include: Aikido L5R Sailing (SJ24)

Updated on July 05, 2022

Comments

  • Paige Watson
    Paige Watson almost 2 years

    Okay, what is it, and why does it occur on Win2003 server, but not on WinXP.

    It doesn't seem to affect my application at all, but I get this error message when I close the application. And it's annoying (as errors messages should be).

    I am using pyOpenGl and wxPython to do the graphics stuff. Unfortunately, I'm a C# programmer that has taken over this Python app, and I had to learn Python to do it.

    I can supply code and version numbers etc, but I'm still learning the technical stuff, so any help would be appreciated.

    Python 2.5, wxPython and pyOpenGL

    • Trevor Boyd Smith
      Trevor Boyd Smith over 6 years
      I think the "no handlers could be found" is a canonical issue that occurs for not just Python's OpenGL library but many python libraries. Right now though when I google "python no handlers could be found for logger" I find this question seems to be the closest I to a canonical question/solution.
    • qwerty
      qwerty over 6 years
      In case someone came here looking for this stackoverflow.com/q/44188270/1581226
  • Moises Silva
    Moises Silva over 8 years
    I presume you were down-voted because ignoring log messages with the NullHandler is rarely the right thing to do. The reported message is often a sign that the logger was not configured at a point when it should have been configured already and you also are ignoring a potential issue with the component that was trying to log something. In some cases using the NullHandler might be the right thing to do, but rarely IMO.
  • anatoly techtonik
    anatoly techtonik over 8 years
    @MoisesSilva for a library NullHandler is a must. It doesn't turn off the logging - it just allows fine-grained control over it Think reset.css
  • Moises Silva
    Moises Silva over 8 years
    You are right. In the context of this question however, the op have his own application that is using OpenGL, so it is best to configure the logger to print the error that OpenGL was trying to report. That lead him to fix the root cause of the problem.
  • Trevor Boyd Smith
    Trevor Boyd Smith over 6 years
    The link provides some interesting reading (blog post with associated official Python bug reports) that demonstrates common issues people have with the Python logging module.