pExpect没有发送密码

问题描述

我有一个示例脚本正在执行自定义CLI命令

    import pexpect
    child = pexpect.spawn('kubectl login --server='+ cluster +' --insecure-skip-tls-verify --vsphere-username=' + os.getenv('VC_USERNAME'))
    child.expect ('Anything')
    child.sendline (os.getenv('VC_PASSWRD'))

但是,我注意到我的密码没有发送,并且我得到了一个密码

pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7fcfba982e50>
command: /app/bin/kubectl 
args: [b'/app/bin/kubectl ',b'login',b'--server=xxxxx',b'--insecure-skip-tls-verify',b'[email protected]']
buffer (last 100 chars): '\r\nPassword: '
before (last 100 chars): '\r\nPassword: '
after: <class 'pexpect.exceptions.TIMEOUT'>

为什么我的密码不发送?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)