On Thu, 30 Dec 2010 13:46:35 -0800, harijay wrote: > Each Thread receives a dynamically generated shell script from some > classes I wrote and then runs the script using > > subprocess.call(["shell_script_file.sh"])
> But I get the same "OSError: [Errno 26] Text file busy" error "Text file busy" aka ETXTBSY occurs if you try to execute a file which is open for write by any process. Be sure to explicitly close() the script before attempting to execute it. Don't rely upon the destructor closing it, as that may be deferred. Also, if you spawn any child processes, ensure that they don't inherit the descriptor being used to write to the script. Ideally, you should set the close-on-exec flag on the descriptor as soon as the file is opened. Using close_fds=True in subprocess.Popen() will solve the issue for processes spawned that way, but you also need to consider subprocesses which may be spawned "behind the scenes" by library functions. -- http://mail.python.org/mailman/listinfo/python-list