Unable to get M1XX operator commands to work in MDI

More
10 May 2021 13:54 #208478 by billskeen63
PathPilot version 2.5.2
Any M1XX command I run I get the following error. This is for M102.

2021-05-10 08:14:57.270405 CDT (+0:00:00.042242) | issuing MDI command: M102 [tormach_mill_ui.py:8114]
on_abort.ngc called

The M102.sh file contents:
#!usr/bin/bash
# coding=utf-8
python M102.py

The M102.py contents:
#!/usr/bin/env python
# coding=utf-8
import sys
print("M102 command test print to screen")
outF = open("/home/operator/Dropbox/M102-CommandTest.txt", "w")
outF.write('M102 command test message will be written to a file')
outF.write('\n')
outF.close()
exit()

The M102.sh file is copied to the /home/operator/tmc/configs/tormach_mill/nc_subs folder as M102. Then I run chmod +x M102, shutdown, powerup mill and run M102 in MDI. Nothing happens. If I open a terminal window, I can run bash M102 and it works.

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

More
10 May 2021 22:57 - 10 May 2021 22:58 #208505 by andypugh
I don't know if this will help with the problem, but you don't need to go via bash.

If you use the shebang
#! /usr/bin/env python
then the M102 executable can be a python file.

In fact the M102 file can be _any_ executable file, but must be called just "M102"

Your M102 file should have no suffix, so the likely problem is that LinuxCNC is not finding a file called "M102" and is not even looking for "M102.sh"

Make a single file called M102. Put your Python in it, make it executable, and LinuxCNC should find and run it.

With the shebang you don't need to "bash M102.sh" or "python M102.[y" If the shebang matches the code inside, then just "./M102" will run the file with the appropriate interpreter.
Last edit: 10 May 2021 22:58 by andypugh.

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

More
26 Jul 2021 01:31 #215919 by smgvbest
2 Things

1. What does it show in the pathpilot.log file in ~GCODE I believe? is it getting called
2. things need to be owned by operator.

#1 will likely be the most help

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

Moderators: cncbasher
Time to create page: 0.062 seconds
Powered by Kunena Forum