80

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

Harley Holcombe
  • 175,848
  • 15
  • 70
  • 63
Paige Watson
  • 1,218
  • 3
  • 17
  • 27
  • 1
    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. – Trevor Boyd Smith Oct 25 '17 at 12:19
  • In case someone came here looking for this https://stackoverflow.com/q/44188270/1581226 – qwerty Nov 29 '17 at 07:14

3 Answers3

196

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.

okoboko
  • 4,332
  • 8
  • 40
  • 67
Kozyarchuk
  • 21,049
  • 14
  • 40
  • 46
3

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

anatoly techtonik
  • 19,847
  • 9
  • 124
  • 140
  • 4
    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. – Moises Silva Jan 11 '16 at 23:38
  • @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` – anatoly techtonik Jan 12 '16 at 01:20
  • 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. – Moises Silva Jan 13 '16 at 13:37
  • 1
    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. – Trevor Boyd Smith Oct 25 '17 at 12:25
2

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.

Paige Watson
  • 1,218
  • 3
  • 17
  • 27