Python script on start
- marcopaluffi
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
19 Aug 2019 11:55 #142488
by marcopaluffi
Python script on start was created by marcopaluffi
Hi! Is possible run automatically a python script on a program start and other one script on the program end?
Thank you!
Thank you!
Please Log in or Create an account to join the conversation.
19 Aug 2019 17:46 #142506
by pl7i92
Replied by pl7i92 on topic Python script on start
yes use a Mcode for your scripts to be started like M130
you might set the io level bevore
mypyprogram.py &
or
halcmd setp iocontrol.0.lube_level 1
#!/usr/bin/python
#my python
myPython.py
exit 0
you might set the io level bevore
mypyprogram.py &
or
halcmd setp iocontrol.0.lube_level 1
Please Log in or Create an account to join the conversation.
- marcopaluffi
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
21 Aug 2019 06:48 #142688
by marcopaluffi
Replied by marcopaluffi on topic Python script on start
Ok, thank you!
Can I insert python script into Mcode?
For example:
Is there any other way to run automatically a python script on a program start without use a Mcode?
Thank you!
Can I insert python script into Mcode?
For example:
#!/usr/bin/python
import os
import sys
txtfile= open('\home\user\Documents\test.txt', 'w')
txtfile.write("TEST SCRIPT")
txtfile.close()
exit 0
Is there any other way to run automatically a python script on a program start without use a Mcode?
Thank you!
Please Log in or Create an account to join the conversation.
27 Aug 2019 23:15 #143368
by andypugh
You can run a HAL file on exit, automatically:
SHUTDOWN = .... linuxcnc.org/docs/2.7/html/config/ini-config.html#_hal_section
The HAL file could[1] "loadusr" a userspace HAL component that makes no pins, asserts "hal.ready" and then quits itself:
linuxcnc.org/docs/2.7/html/hal/halmodule.html
[1] Probably. I have never tried this.
Replied by andypugh on topic Python script on start
Is there any other way to run automatically a python script on a program start without use a Mcode?
Thank you!
You can run a HAL file on exit, automatically:
SHUTDOWN = .... linuxcnc.org/docs/2.7/html/config/ini-config.html#_hal_section
The HAL file could[1] "loadusr" a userspace HAL component that makes no pins, asserts "hal.ready" and then quits itself:
linuxcnc.org/docs/2.7/html/hal/halmodule.html
[1] Probably. I have never tried this.
Please Log in or Create an account to join the conversation.
Time to create page: 0.074 seconds