Replies: 2 comments 4 replies
-
|
Hum, there are two things I don't like about this code -- first, it depends on the |
Beta Was this translation helpful? Give feedback.
4 replies
-
|
+1 for supporting |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm wondering if something like pybind11's
scoped_ostream_redirectis available in nanobind?Currently, the output from a C++ function which prints to
std::coutis only visible in the terminal when running inside a Jupyter notebook.I tried to implement
scoped_ostream_redirectas a call guard, borrowing code from here, with some success.In the minimal example below I managed to see "before" printed (in both the terminal and a notebook) but not the output from
foo()or the "after". Moreover, running in the Jupyter notebook ends up killing the kernel before the function returns.My reimplementation is below, almost verbatim from pybind11.
Beta Was this translation helpful? Give feedback.
All reactions