is it possible to use python multiprocessing in IP10?
I'm trying to start a long running Python program, that runs in the background (i.e. doesn't take focus/time away from Igor), with which I can also communicate. The only communication I wish to do is shut the python program down.
I have Python code along the lines of
# task.py
import time
def task(queue, shutdown_event):
while True:
time.sleep(1.0)
if shutdown_event.is_set():
print("Shutting down")
break
print("Number 5 is alive")
I then try to start it running via the following lines in the python:
from multiprocessing import Process, Queue, Event
import task
shutdown_event = Event()
queue = Queue()
tasker = Process(target=task.task, args=(queue, shutdown_event))
tasker.start()
However, I get the following turning up in the Igor command window:
Error -43 trying to open a file specified in start-up command: C:Program Files:WaveMetrics:Igor Pro 10 Folder:-c
Error -43 trying to open a file specified in start-up command: C:Program Files:WaveMetrics:Igor Pro 10 Folder:from multiprocessing.spawn import spawn_main; spawn_main(parent_pid=6524, pipe_handle=3084)
Error -43 trying to open a file specified in start-up command: C:Program Files:WaveMetrics:Igor Pro 10 Folder:--multiprocessing-fork
Does the python integration of IP10 allow further subprocesses or processes to start? A poorer alternative is using ExecuteScriptText, but it becomes a pain to stop the program running. I'd have to communicate via a value in a file or something along those lines.
Clarification, I tried to start it from the Python console in IP10.
September 24, 2026 at 11:32 pm - Permalink
I think that the multiprocessing library points to the process that it is being run on. So all you should have to do is point the library to the Python executable to create separate Python processes.
This is what it would look like:
September 28, 2026 at 03:10 pm - Permalink
Great, that seems to work.
September 29, 2026 at 05:14 pm - Permalink