Python Component issueing errors or warnings to LinuxCNC

More
23 Apr 2021 15:15 #206878 by mwinterm
Hello,

I have the hopefully trivial questions how to issue errors and warnings from a Python component?

Best regards,

Marc

Please Log in or Create an account to join the conversation.

More
23 Apr 2021 21:51 #206891 by cmorley
Would need more info.
Usually errors are shown with dialogs or printed in the terminal

But your question is vague.

What errors? Linxcnc's ?....the programs's ?

Are you using a GUI library or do you just want to print to the terminal to debug?

If you wish to display linuxcnc errors - it can be tricky and depends on what (if) screen is also being used.

Please Log in or Create an account to join the conversation.

More
24 Apr 2021 09:46 #206940 by mwinterm
I would like to display an LinuxCNC error. When I do this out of a remap.py and can do it with e.g.
from emccanon import MESSAGE

and then use
MESSAGE("This is my message")

and it pops up in LinuxCNC (Axis GUI and GMOCCAPY).
Even though I'm also there missing how to specify something like a message level to define if it is just a message, warning, error....

I would like to do the same from Python component.

Please Log in or Create an account to join the conversation.

More
24 Apr 2021 21:24 #206969 by cmorley
unfortunately that library is unavailable outside of remap code.
I know of no other way to send a user message through linuxcnc's error channel.
I worked around this problem in qtvcp by sending linuxcnc's error messages through GObject messages so i could add my own messages.
But this is screen dependent and cannot be done with multiple python programs on the same system.

I think the error system in linuxcnc could use a re-think specifically for there problems.

the easiest thing to do is pop your own messag dialogs.
GMoccapy, gscreen and qtvcp can pop messages controlled by HAL pins.
It does mean the messages can't change after start up.

Or you can build your own dialog in your python code.

Chris

Please Log in or Create an account to join the conversation.

More
25 Apr 2021 17:41 #207034 by mwinterm
Thank you Chris. Unfortunately not the easy solution I have hoped for...

Regards,

Marc

Please Log in or Create an account to join the conversation.

More
29 Apr 2021 08:40 #207356 by andypugh
This is inelegant, but I think that you could MDI a magic G-code comment.

If you wanted to halt execution with an error:
c.mdi("(ABORT, Out of cheese error)")

There are limitations on MDI:
linuxcnc.org/docs/2.8/html/config/python...ing_to_send_commands

Please Log in or Create an account to join the conversation.

More
29 Apr 2021 14:24 #207377 by cmorley
We should create a NML message command for this purpose that can be send from python's linuxcnc module. I wonder how hard that would be.

Please Log in or Create an account to join the conversation.

More
30 Apr 2021 13:33 #207452 by Roiki
Afaik it already exists, it's just not included in the python module.

Please Log in or Create an account to join the conversation.

More
30 Apr 2021 14:27 #207458 by cmorley
What makes you say that?

Please Log in or Create an account to join the conversation.

More
01 May 2021 21:50 #207577 by andypugh

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum