M100 running Python
JT
Please Log in or Create an account to join the conversation.
You should get either python errors or bash errors output to stderr and displayed in the terminal.
regards
Please Log in or Create an account to join the conversation.
Edit: No errors reported. Both files execute from the terminal but not from within LinuxCNC
JT.
Please Log in or Create an account to join the conversation.
If you are still struggling in the morning (here), I'll give it a try.
Never tried it before personally.
regards
Please Log in or Create an account to join the conversation.
Search order for M files:
A search is made for each possible user defined function, typically (M100-M199). The search order is:
[DISPLAY]PROGRAM_PREFIX (if specified)
If [DISPLAY]PROGRAM_PREFIX is not specified, search the default location: nc_files
Then search each directory in the list [RS274NGC]USER_M_PATH
The first executable M1xx found in the search is used for each M1xx.
Note also:
Source code Ref: git.linuxcnc.org/gitweb?p=linuxcnc.git;a...bd7b27d7;hb=HEAD#l861) The file must be executable (as stated above) use chmod +x to set.
2) The file must be named starting with a captial M.
(but gcode itself doesn't care about capitalization so you can invoke with lower case m)
3) The most common location is probably using [DISPLAY]PROGRAM_PREFIX.
4) Using [RS274NGC]USER_M_PATH is more flexible if you manage many m files.
5) The use of nc_files is probably uncommon as nc_files refers to a directory
relative to the directory containing the inifile (e.g. a subdirectory of the
inifile directory or a symbolic link in the inifile directory named (nc_files)
that points to another directory.
6) The search is made once at program startup -- you cannot dynamically add
files or change permissions while runnning.
Please Log in or Create an account to join the conversation.
I have it running, but only by changing a bit.
I made it executable and invoked python directly
Imported os and ran system() to load into iceweasel
I am unsure how clicking on the file ever displayed it previously, unless you were doing so from something that picked up the mime type (like a file manager) and automatically launched it in a browser
The only problem is that the refresh falls foul of my settings for iceweasel and it does not display anything unless you press F5 manually to refresh and display it
Substituting other html code works fine
#! /usr/bin/python
import os
fo = open('status.html', 'w')
info = '''
<HTML>
<HEAD>
<meta http-equiv="refresh" content="10"> <!-- Refresh every 1 minute -->
<TITLE>Change Part</TITLE>
</HEAD>
<BODY>
<p>Change Part!</p>
</BODY>
</HTML>
'''
fo.write(info)
fo.close
os.system("iceweasel status.html")
quit()
regards
Please Log in or Create an account to join the conversation.
I had the html page open in icewheasel prior to running so I was looking for the change only.
Thanks for looking
JT
Please Log in or Create an account to join the conversation.