Skip to content Skip to sidebar Skip to footer

Spawn A New Non-blocking Process Using Python On Mac Os X

I found some articles and even stack|overflow questions addressing this subject, but I still can't do it.. What I want to do is open an instance of firefox from python. then the py

Solution 1:

To show what I meant:

import osifnotos.fork():
    os.system('firefox')
os._exit(0)

Version that doesn't quit the main Python process:

import osifnotos.fork():
    os.system('firefox')
    os._exit(0)

Solution 2:

You'll need to detach the process somehow. I snatched this from spawning process from python

import os
pid = os.fork()
if0 == pid:
  os.system('firefox')
  os._exit(0)
else:
  os._exit(0)

This spawns a forked headless version of the same script which can then execute whatever you like and quit directly afterwards.

Post a Comment for "Spawn A New Non-blocking Process Using Python On Mac Os X"