PSoC Creator post-build

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
TamirM
Level 2
Level 2
25 sign-ins First like given 10 questions asked

I'm using a post-build python script which uses the ELF file (that is the reason for *post*-build).

if i catch an error by the script logic I want to invoke an #error, how can I do that?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @TamirM 

I have attached a python script here. Try running the same in the post build step of PSoC Creator.

I have used the raise exception technique to be able to raise custom exceptions in the python script and the same will appear in red in the PSoC Creator console to mark importance.

Since raising the exception will also cause the python script to fail, it will raise the 'Post Build step failed' error in the 'Notice List' and at the same time display the error message you want to display in the console in red.

Make sure the class name of the exception contains the keyword 'error' for PSoC Creator console to show it in red. 
You can also show it in blue for warnings using the Warning keyword in the exception class name.

Let me know if this is what you were looking for.

Warm Regards
Alen

View solution in original post

0 Likes
6 Replies
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @TamirM 

If the error is occurring in your python script and If you are sure of where the error occurs, then I believe a try catch exception would be sufficient for this where you can print out the exception/error message in the 'except:'.

Is this what you are looking for or if not, can you be more specific about the error and where it occurs and if possible, share your script so we can try out the same on our side ( a sample script of what you expect will also be fine )

Warm Regards
Alen

0 Likes

Hi Alen,

thank you for your response.

i think i wasn't clear enough.

i'm doing some sanity test on the code in the python script.

there is no error/exception in the python part.

what i can do for now is use "print" python function to write to the console if i've found any problem, but i want to do something more "extreme"  so the user will not be able to ignore, like failing to compilation

0 Likes

i want to invoke this error:

Build error: Post Build step failed, see output window for more information.

0 Likes
lock attach
Attachments are accessible only for community members.
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @TamirM 

I have attached a python script here. Try running the same in the post build step of PSoC Creator.

I have used the raise exception technique to be able to raise custom exceptions in the python script and the same will appear in red in the PSoC Creator console to mark importance.

Since raising the exception will also cause the python script to fail, it will raise the 'Post Build step failed' error in the 'Notice List' and at the same time display the error message you want to display in the console in red.

Make sure the class name of the exception contains the keyword 'error' for PSoC Creator console to show it in red. 
You can also show it in blue for warnings using the Warning keyword in the exception class name.

Let me know if this is what you were looking for.

Warm Regards
Alen

0 Likes

Thanks, I've already used 'raise TypeError()' or 'raise Exception()' which worked!

0 Likes
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @TamirM ,

Glad your query is resolved.
Please feel free to post any queries or issues you may have on the community and we will be happy to help.

Warm Regards
Alen

0 Likes