I am trying to use the cx_Oracle module with python 2.6.6 on ubuntu Maverick, with Oracle 11gR2 Enterprise edition.
I am able to connect to my oracle db just fine, but once I do that, the subprocess module does not work anymore. Here is an iPython session that reproduces the problem...
In [1]: import subprocess as sp, cx_Oracle as dbh
In [2]: sp.call(['whoami'])
sharat
Out[2]: 0
In [3]: con = dbh.connect('system', 'password')
In [4]: con.close()
In [5]: sp.call(['whomai'])
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
/home/sharat/desk/calypso-launcher/<ipython console> in <module>()
/usr/lib/python2.6/subprocess.pyc in call(*popenargs, **kwargs)
468 retcode = call(["ls", "-l"])
469 """
--> 470 return Popen(*popenargs, **kwargs).wait()
471
472
/usr/lib/python2.6/subprocess.pyc in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
621 p2cread, p2cwrite,
622 c2pread, c2pwrite,
--> 623 errread, errwrite)
624
625 if mswindows:
/usr/lib/python2.6/subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)
1134
1135 if data != "":
-> 1136 _eintr_retry_call(os.waitpid, self.pid, 0)
1137 child_exception = pickle.loads(data)
1138 for fd in (p2cwrite, c2pread, errread):
/usr/lib/python2.6/subprocess.pyc in _eintr_retry_call(func, *args)
453 while True:
454 try:
--> 455 return func(*args)
456 except OSError, e:
457 if e.errno == errno.EINTR:
OSError: [Errno 10] No child processes
So, the call to sp.call works fine before connecting to oracle, but breaks after that. Even if I have closed the connection to the database.
Looking around, I found http://bugs.python.org/issue1731717 as somewhat related to this issue, but I am not dealing with threads here. I don't know if cx_Oracle is. Moreover, the above issue mentions that adding a time.sleep(1) fixes it, but it didn't help me.
Any help appreciated. Thanks.