Skip to content

Instantly share code, notes, and snippets.

View arenaudineau's full-sized avatar
🙂

Adrien Renaudineau arenaudineau

🙂
View GitHub Profile
@arenaudineau
arenaudineau / stderr_redirect.py
Last active June 28, 2022 06:58 — forked from natedileas/redirect.py
c-level stderr redirection on windows, compatible with Jupyter Notebooks
"""
!! ADAPTED FROM https://gist.github.com/natedileas/8eb31dc03b76183c0211cdde57791005 !!
"""
from contextlib import contextmanager
import io, os, sys, ctypes, tempfile
if sys.version_info < (3, 5):
libc = ctypes.CDLL(ctypes.util.find_library('c'))
else: