oldwrite = stream.write def _write(a): if isinstance(a, str): stream.stream.write(a) else: oldwrite(a) return _write sys.stdout = codecs.getwriter(sys.stdin.encoding)(sys.stdout, errors='ignore') sys.stderr = codecs.getwriter(sys.stdin.encoding)(sys.stderr, errors='ignore') sys.stdout.write = writer(sys.stdout) sys.stderr.write = writer(sys.stderr) custom_traceback.install() # IMPORTANT: Must set OpenGL.BLAH_BLAH **BEFORE** importing OpenGL.GL if "-log" in sys.argv: sys.argv.remove('-log') OpenGL.FULL_LOGGING = True if "-debug" not in sys.argv: OpenGL.ERROR_CHECKING = False else: while "-debug" in sys.argv: sys.argv.remove('-debug') print("GL Errors enabled!") import os
stream.stream.write(a) else: oldwrite(a) return _write ioencoding = sys.stdin.encoding or 'utf-8' sys.stdout = codecs.getwriter(ioencoding)(sys.stdout, errors='ignore') sys.stderr = codecs.getwriter(ioencoding)(sys.stderr, errors='ignore') sys.stdout.write = writer(sys.stdout) sys.stderr.write = writer(sys.stderr) custom_traceback.install() # IMPORTANT: Must set OpenGL.BLAH_BLAH **BEFORE** importing OpenGL.GL if "-log" in sys.argv: sys.argv.remove('-log') OpenGL.FULL_LOGGING = True if "-debug" not in sys.argv: OpenGL.ERROR_CHECKING = False else: OpenGL.ERROR_LOGGING = True OpenGL.CONTEXT_CHECKING = True while "-debug" in sys.argv: sys.argv.remove('-debug') print("GL Errors enabled!")