Python-2.4.1 and fork

I had hoped to be able to get more of this on my own rather than coming back for help so soon but alas, I’m not so clever. :blush:
I have Python-2.4.1 installed, but I keep discovering holes when I try to use another program that relies on Python (but at least it’s installed now thanks to some help I got earlier :slight_smile: ) This time, I’m getting an OSError raised and it complains that the os.fork() function isn’t implemented. I’ve done some tinkering and tried to use the os.forkpty() function with no luck and I also tried to use pty.fork() but didn’t get much farther (pty.fork() seems to rely on os.fork() so I guess there should be no surprise there). I did look at the documentation at and it seemed to imply that fork() was a UNIX only thing. Does any one have any ideas to fix this?

Thanks again and in advance,

From the Neutrino documentation:

Currently, fork() is supported only in single-threaded applications. If you create a thread and then call fork(), the function returns -1 and sets errno to ENOSYS.

I think this is most likely what you are seeing. Are you able to change the application to use spawn() instead?

I don’t know that spawn will work. From reading its documentation, it looks to me as though spawn is expecting to execute another program in the new process. I think the intentions of the original code are to have the child process pick up at the same place in the original program. It’s got the whole

pid = os.fork() if pid == 0: ..... else: ..... thing going on. I will give the spawn idea a try though. Thanks!


Rats… spawn doesn’t seem to be what I want. At least, after some more tinkering, I can maybe add detail to my predicament: just trying os.fork() on the python command line “runs” it okay but I get: “sem_wait: >>> Invalid argument”. It even seems to do the forking correctly but when I kill the child process, I get a series of about 9 or 10 “sem_wait: Invalid argument” and “sem_post: Invalid argument” statements. Perhaps I’m asking the wrong question again and trying to fix a symptom and let the cause go?

Thanks in advance,

Have you checked the pyqnx project. ?

The pyqnx project doesn’t have anything for Python 2.4.1. They have earlier versions which are not what I’m asking about. The program I’m trying to get to work needs a later version of Python than what pyqnx has up (though I did try them before even starting with 2.4.1). Thanks for the suggestion though.


You might want to check with Armin the project admin for the pyqnx.

I see you already had discussions with him in another thread: