devNull = open(os.devnull, 'w')
command = subprocess.Popen(program, stdout=devNull, stdin=subprocess.PIPE,
    stderr=subprocess.PIPE)
child = fdpexpect.fdspawn(command.stderr)
child.expect('hi')
Extracting stderr from pexpect