Python Component issueing errors or warnings to LinuxCNC
- mwinterm
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 70
- Thank you received: 13
			
	
						23 Apr 2021 15:15				#206878
		by mwinterm
	
	
		
			
	
			
			 		
													
	
				Python Component issueing errors or warnings to LinuxCNC was created by mwinterm			
			
				Hello,
I have the hopefully trivial questions how to issue errors and warnings from a Python component?
Best regards,
Marc
					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.
- cmorley
- Away
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 7230
- Thank you received: 2106
			
	
						23 Apr 2021 21:51				#206891
		by cmorley
	
	
		
			
	
			
			 		
													
	
				Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC			
			
				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.
					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.
- mwinterm
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 70
- Thank you received: 13
			
	
						24 Apr 2021 09:46				#206940
		by mwinterm
	
	
		
			
	
			
			 		
													
	
				Replied by mwinterm on topic Python Component issueing errors or warnings to LinuxCNC			
			
				I would like to display an LinuxCNC error. When I do this out of a remap.py and can do it with e.g.
and then use
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.
					from emccanon import MESSAGEand 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.
- cmorley
- Away
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 7230
- Thank you received: 2106
			
	
						24 Apr 2021 21:24				#206969
		by cmorley
	
	
		
			
	
			
			 		
													
	
				Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC			
			
				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
					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.
- mwinterm
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 70
- Thank you received: 13
			
	
						25 Apr 2021 17:41				#207034
		by mwinterm
	
	
		
			
	
			
			 		
													
	
				Replied by mwinterm on topic Python Component issueing errors or warnings to LinuxCNC			
			
				Thank you Chris. Unfortunately not the easy solution I have hoped for...
Regards,
Marc
					Regards,
Marc
Please Log in or Create an account to join the conversation.
- andypugh
- 
				  
- Offline
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 19677
- Thank you received: 4554
			
	
						29 Apr 2021 08:40				#207356
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Python Component issueing errors or warnings to LinuxCNC			
			
				This is inelegant, but I think that you could MDI a magic G-code comment.
If you wanted to halt execution with an error:
There are limitations on MDI:
linuxcnc.org/docs/2.8/html/config/python...ing_to_send_commands
					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.
- cmorley
- Away
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 7230
- Thank you received: 2106
			
	
						29 Apr 2021 14:24				#207377
		by cmorley
	
	
		
			
	
			
			 		
													
	
				Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC			
			
				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.
- Roiki
- Offline
- Premium Member
- 
				  
		Less
		More
		
			
	
		- Posts: 116
- Thank you received: 19
			
	
						30 Apr 2021 13:33				#207452
		by Roiki
	
	
		
			
	
			
			 		
													
	
				Replied by Roiki on topic Python Component issueing errors or warnings to LinuxCNC			
			
				Afaik it already exists, it's just not included in the python module.			
					Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 7230
- Thank you received: 2106
			
	
						30 Apr 2021 14:27				#207458
		by cmorley
	
	
		
			
	
			
			 		
													
	
				Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC			
			
				What makes you say that?			
					Please Log in or Create an account to join the conversation.
- andypugh
- 
				  
- Offline
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 19677
- Thank you received: 4554
			
	
						01 May 2021 21:50				#207577
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Python Component issueing errors or warnings to LinuxCNC			
			
				There do seem to be messages:
github.com/LinuxCNC/linuxcnc/blob/2e75b0..._intf/emc_nml.hh#L33
And emcmodule seems to read them, but not write them?
github.com/LinuxCNC/linuxcnc/blob/2e75b0...s/emcmodule.cc#L1496
					github.com/LinuxCNC/linuxcnc/blob/2e75b0..._intf/emc_nml.hh#L33
And emcmodule seems to read them, but not write them?
github.com/LinuxCNC/linuxcnc/blob/2e75b0...s/emcmodule.cc#L1496
Please Log in or Create an account to join the conversation.
		Time to create page: 0.097 seconds	
