Geert Dierick - 2025-03-05

Hi,

Python.NET works like a charm in DWSim.

However, it looks like the normal Python output console (std.out) is not redirected to the Information Panel (messages).
The following code:

print("Hello World")

Always results in this error:

Error running script '': Python.Runtime.PythonException: a bytes-like object is required, not 'str'

An easy workaround is:

Flowsheet.WriteMessage("Hello World")

More problematic are imported packages who also write to std.out.
One cannot easily change their output, leading to the above error.

I was hoping to use the Python Debugger (pdb) to debug Python.NET.
But pdb interacts with the console, leading to the error above.

My question:
Any chance of creating a console for Python.NET?
If only to be able to use a debugger.

Best regards,

Geert