Skip to content

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented Aug 30, 2025

This pull request introduces and fixes the handling of standard stream redirection in the PythonQt module.

  • Fix incorrect conditions in setRedirectStdInCallbackEnabled to ensure proper stdin redirection.
  • Add support for redirecting stdout and stderr to custom callbacks.
  • Introduce methods to enable or disable redirection and to query the current redirection state.

Note

For reference, those patches were developed in the context of the commontk/PythonQt fork.

Cherry picked from commits:

jcfr added 3 commits August 30, 2025 19:41
This changes the conditions in setRedirectStdInCallbackEnabled to correctly
check for the presence of 'pythonqt_stdin' and 'pythonqt_original_stdin'
attributes. This ensures proper redirection of stdin.

(cherry picked from commit commontk/PythonQt@ddecb44)
This improves the PythonQt module by adding functionality to redirect
stdout and stderr to custom callbacks. It includes methods to enable or
disable redirection and to check if redirection is currently enabled.

(cherry picked from commit commontk/PythonQt@3d3943f)
This fixes a build error on Windows by renaming the 'stdout' variable to
`sys_stdout' to avoid conflicts with system headers.

(cherry picked from commit commontk/PythonQt@5487c61)
@usiems usiems merged commit 0fe0ac9 into MeVisLab:master Sep 1, 2025
19 checks passed
@jcfr jcfr deleted the backport-commontk/fix-stdout-stderr-redirection-support branch October 2, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants