pexpect exceptions

Michael Surette msurette at
Mon Jan 26 23:07:36 CET 2004

I have been trying to automate the changing of passwords using python and
pexpect.  I wrote a script as a test and it works, except that it gives me
an exception when it stops running:

Exception exceptions.OSError: 
(10, 'No child processes') in <bound method spawn.__del__ of
<pexpect.spawn instance at 0x403d938c>> ignored

What is happening and how do I get rid of the exception?

I am running python 2.3.2 under Slackware linux 9.1 and pexpect 0.99. 
Here is the script:

import pexpect
import sys

if len(sys.argv) != 3:
  print 'usage error!'
  raise SystemExit

name= sys.argv[1]
passwd= sys.argv[2]

a= pexpect.spawn('passwd %s'%name)

changed= False
while not changed:
  i= a.expect(['[Nn]ew password:','[Cc]hanged'])
  if i == 0:
  elif i == 1:
    changed= True

More information about the Python-list mailing list