Error: Parsing of json failed for [PythonActionEngineOutput]

I am in 7.9.0, I am trying to execute a python code and I get this error Error: Parsing of json failed for [PythonActionEngineOutput]
The documentation of PythonActionEngineOutput mentions that Action output is returned as a json containing the stdout log statements from the Python process and the result of the C3 action call but it is not clear to me how to avoid this error.
Thanks !

Are you using print in your Python code?

If you need to log things from Python, be sure to use the logger instead of print, since as the documentation says, we rely on stdout to communicate the result of the C3 action back to the caller. (I’m not too familiar with Python, but a quick web search suggests that Python’s print uses stdout by default?)

Here are some helpful posts regarding logging in Python:

Thanks Matt for your answer.

No, I am not using print but I am training a model and it outputs some logs so it might be the reason why the parsing fails. I am going to try catching these.