extended provision-backend

Michael Ströder michael at stroeder.com
Thu Aug 6 10:54:36 MDT 2009


Oliver Liebel wrote:
> i got a little python question and i think you can help:
> 
> i got his peace of code:
>      p = Popen(slapdcommand_prov,shell=False)
>        sts = os.waitpid(p.pid, 0)
> to start slapd from the python provision-script.
> 
> slapcommand_prov is a generated string, that looks like this:
> /usr/local/libexec/slapd -f /usr/local/samba/private/ldap/slapd.conf -h
> ldapi://%2Fusr%2Flocal%2Fsamba%2Fprivate%2Fldap%2Fldapi
> 
> no matter what i try (using the exact command instead of generated string),
> this error is always returned:
>  p = Popen(slapdcommand_prov,shell=False)
> TypeError: 'str' object is not callable

Which version of Python are you using?
I've never worked with the new module subprocess but I will test with my system.

I've tried with Python 2.6 (stock openSUSE 11.1 RPMs):

>>> import subprocess
>>> p = subprocess.Popen('/opt/openldap-RE24/libexec/slapd -f
/home/michael/temp/openldap-testbed-RE24/slapd-1.conf -d 9 -h
ldapi://%2Fhome%2Fmichael%2Ftemp%2Fopenldap-testbed-RE24%2Fslapd1',shell=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/subprocess.py", line 595, in __init__
    errread, errwrite)
  File "/usr/lib/python2.6/subprocess.py", line 1106, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
>>>

But it works with Shell=True. Hmm...really strange.

Ciao, Michael.


More information about the samba-technical mailing list