Python exception doesn't show in KNIME console

Hi everyone,

I have a script running in a “Python Script” node that throws an exception (KNIME v4.7.6) . I’d like for KNIME to print out that exception text - at the moment it doesn’t do that, not even on debug level ‘DEBUG’.

Am I missing something here? Should I use print statements instead of exceptions to get KNIME console output?

Many thanks.

Hi @kermitthefrog01,

an exception like this?

try:
    raise Exception("la la la")
except Exception as e:
    raise Exception(f"The exception is: {e}")

It gives me the following error:

Can you show me how you tried it?

Thanks
Steffen

2 Likes

@kermitthefrog01 you could try and build your individual Python logger like in this example:

3 Likes

Thanks for your example. It worked fine for me.

Then, I looked into my code and realised that I made a mistake: my code failed before it even reached the exception. Basically I defined a variable based on a dataframe column before running my exception checks. In the edge case of providing an empty table, I never even got to the exceptions. :slight_smile:

I’ll clean that up. Thanks again for the help! :vulcan_salute:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.