- General
- General LinuxCNC Questions
- python script , linuxcnc cannot terminate / unable to reload .ini file
python script , linuxcnc cannot terminate / unable to reload .ini file
- giantstone
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 0
24 Nov 2018 04:01 #121282
by giantstone
Hi, My machine need two sets of ini parameters, (the motor scale should be different under two different situations as measurements suggests so)
I start linuxcnc via python by the following script :
import subprocess
ini_address='/home/sam/linuxcnc/configs/qgj/'
ini_file_name = 'qgj2.ini'
bashCommand= 'linuxcnc ' +ini_address+ini_file_name
# linuxcnc /home/sam/linuxcnc/configs/qgj/qgj.ini
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE )
and I tried to terminate the linuxcnc in order to restart it to load a different ini., by the following methods:
#### process.communicate(" ^C")
## process.kill() #terminate()
## raise KeyboardInterrupt
## os.kill(os.getpid(), signal.SIGUSR1)
## os.kill(os.getpid(), signal.SIGUSR1)
## os._exit(0) #sys.exit()
## thread.interrupt_main()
none of the above methods worked to terminate linuxcnc. ( i tried to do start linuxcnc in a thread, and then call thread.interrupt_main(), and it did not work).
But, If i manually press ctrl+c in the shell on which the python script is excuted, linuxcnc will close.
could someone help me to deal with this problem? I want to start and terminate linuxcnc all by python scripts.
Thanks very much!
I start linuxcnc via python by the following script :
import subprocess
ini_address='/home/sam/linuxcnc/configs/qgj/'
ini_file_name = 'qgj2.ini'
bashCommand= 'linuxcnc ' +ini_address+ini_file_name
# linuxcnc /home/sam/linuxcnc/configs/qgj/qgj.ini
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE )
and I tried to terminate the linuxcnc in order to restart it to load a different ini., by the following methods:
#### process.communicate(" ^C")
## process.kill() #terminate()
## raise KeyboardInterrupt
## os.kill(os.getpid(), signal.SIGUSR1)
## os.kill(os.getpid(), signal.SIGUSR1)
## os._exit(0) #sys.exit()
## thread.interrupt_main()
none of the above methods worked to terminate linuxcnc. ( i tried to do start linuxcnc in a thread, and then call thread.interrupt_main(), and it did not work).
But, If i manually press ctrl+c in the shell on which the python script is excuted, linuxcnc will close.
could someone help me to deal with this problem? I want to start and terminate linuxcnc all by python scripts.
Thanks very much!
Please Log in or Create an account to join the conversation.
- giantstone
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 0
24 Nov 2018 04:19 #121283
by giantstone
Replied by giantstone on topic python script , linuxcnc cannot terminate / unable to reload .ini file
update, the above methods did close a " linuxcnc tool changer (thread) ", but it did not terminate the main linuxcnc program.
Please Log in or Create an account to join the conversation.
- General
- General LinuxCNC Questions
- python script , linuxcnc cannot terminate / unable to reload .ini file
Time to create page: 0.100 seconds