[Pythonmac-SIG] urllib2.urlopen fails in a forked daemon with a CoreFoundation error

Jarkko Laiho jarkko.laiho at iki.fi
Mon Mar 16 17:45:23 CET 2009


>> http://code.activestate.com/recipes/278731/
> So, that recipe is inadequate on OS X -- you pretty much have to do an
> exec after the fork.  Doesn't matter which of the exec functions you
> use -- use the most convenient one.  What you're trying to accomplish
> is re-initialization of some of the memory structures of your process.

All right, that's good to know, but I'm probably not communicating the
level of my confusion very well here :-). I have NO IDEA what the
exec() call should contain (and thus, no idea which one is "the most
convenient").

>From the Python documentation for the exec*() functions: "These
functions all execute a new program, replacing the current process;
they do not return."

I don't want to "execute a new program". I just want to daemonize the
one that's running.

So ultimately the question is: how should the forking code in the
recipe be modified, so that it satisfies the requirements of OS X?
What does an actual, concrete exec() call look like in this case, and
at what point in the code should it occur?

- Jarkko L.


More information about the Pythonmac-SIG mailing list