2023-01-03, 19:37
Hello everyone,
I'm trying to run a shared library from plugin code.
I do see that code runs fine, but I cannot see/catch stdout/stderr.
My python code is simple:
Library is writing to Stdout. It works (I do verify it), and when I run same code through Subprocess with `proc.stdout.readline()` it properly catches the output, but I want to run it now as a shared library.
I was googling and trying different approaches, but since `sys.stdout` is a custom code, that logs everything, I can't get `sys.stdout.fileno()`.
As far as I understand, on Linux it should not be an issue (have not tried yet), but I first try to run on Windows.
Would appreciate any advice/help!
I'm trying to run a shared library from plugin code.
I do see that code runs fine, but I cannot see/catch stdout/stderr.
My python code is simple:
python:
lib = ctypes.cdll.LoadLibrary(library_path)
library_thread = threading.Thread(target=start_library, args=[lib])
library_thread.start()
def start_library(lib):
log.info("Calling start!")
lib.start()
Library is writing to Stdout. It works (I do verify it), and when I run same code through Subprocess with `proc.stdout.readline()` it properly catches the output, but I want to run it now as a shared library.
I was googling and trying different approaches, but since `sys.stdout` is a custom code, that logs everything, I can't get `sys.stdout.fileno()`.
As far as I understand, on Linux it should not be an issue (have not tried yet), but I first try to run on Windows.
Would appreciate any advice/help!