You don't have to write it to disk - you can use cStringIO.
Sorry, please disregard this - I was thinking about something else. The way I've done Python process spawning before was to have my code predefined in a string, and then launched via a ProcessProtocol. You can do tricks whereby you have your code actually defined in a string, then you generate your Python source to run tests/etc. on *that*, and then you send your code-string to python -c when you actually want to run it in a separate process. I remember playing around with inspect before, but I gave up at some point and took the path of least resistance. Cheers, Reza -- Reza Lotun mobile: +44 (0)7521 310 763 email: firstname.lastname@example.org work: email@example.com twitter: @rlotun