Page 1 of 1

How to get Python scripts to fail quietly?

PostPosted: Thu Feb 08, 2018 2:03 pm
by WorkflowsGuy
I have just written my first Python script for Hazel (an external script used in an action).
This works quite well, except for one thing:

Every time the script returns with "1" because it's preconditions are not met, Hazel shows a "Script failed..." notification.

I have tried both "sys.exit(1)" and "exit (1)", but the result remains the same.
In contrast, a bash script that is quit with "exit 1" does not produce such a notification.

Is there anything special that I have to do?

Thanks!

Re: How to get Python scripts to fail quietly?

PostPosted: Fri Feb 09, 2018 11:31 am
by Mr_Noodle
Shell scripts are supposed to return 0 for successful execution. You only return non-zero status if there was an error.