Python Syntax error handling

Hi,

I use Jenkins (a Pipeline job) to integrate a Python project.
I have a problem with Syntax Errors. I can see that they are reported in the Console Output,
but the step is marked successful.
How can I handle these situations?

Thanks!

It’s hard to give an accurate answer with so little details, but I assume you call something like sh 'mycommand'. The return code of mycommand determines whether a step is successful (return code is 0), or not.

Thank you!
Yes, indeed I gave too little details.
I knew the return code is used to determine whether the step is successful or not. Thing is that when I worked with languages that are compiled, this return code was automatically set.
In Python I see that it is not and I wanted to know if there is a possibility to handle these situations directly from the pipeline, without updating the script inside (sh ‘python python_script.py’)

Regards
Tudor

The default exit code is 0, so python will give you exit code 0 unless it fails to complete due to a thrown exception. If you want to change that exit code you need to tell your script to return it.

No compiled language will automatically set an exit code unless you do something that changes the code, like uncaught exception, just like python.

Very confused what problem you are having, and what you are trying to solve.

Hi,
Alright, thank you, I got it!
I am sorry for being unclear, I am new to this so it was a bit hard to explain my problem.
But I understood what you said, so thanks:)