Python Hal Components

More
28 Feb 2020 02:52 #158717 by satiowadahc
I have a pyqt based GUI, that calls various other scripts programmers have written most of which have their own HAL components.

The issue is they all get the same python process ID so if I close one, I close them all. Is there a way to call them in a separate process through python? Sometimes the other scripts fail and I want to be able to call them again, but their component still exists so I have to unload the component, which kills the process, which kills the gui?

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

More
28 Feb 2020 06:05 #158726 by cmorley
Replied by cmorley on topic Python Hal Components
How do you open them?

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

More
29 Feb 2020 16:03 #158819 by satiowadahc
Replied by satiowadahc on topic Python Hal Components
I've tried Popen[python, halcomp.py], and hal.component('Component2').

The current method is Popen, which is nice that it gives a seperate window to distinguish the debugging commands

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

More
29 Feb 2020 18:19 #158831 by cmorley
Replied by cmorley on topic Python Hal Components
If the script fails with a component that starts bit doesn't finish initializing I can see that as a problem that is hard to back out of, but if the component issued hal.ready() then you should be able to unload it with HAL commands.

Can you post a small minimal sample program that shows the issue?

Chris

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

More
12 Mar 2020 13:57 #159870 by satiowadahc
Replied by satiowadahc on topic Python Hal Components
Apparently I wasn't getting reply notifications. Our solution ended up being, call the beta hal component with Popen. Then in the python side catching exceptions and sending the sigterm to its own process and seems to allow us to not kill the main linuxcnc process.

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

Time to create page: 0.091 seconds
Powered by Kunena Forum