Search code examples
pythonwindowspexpect

Unable to spawn a python shell using winpexpect


I'm trying to spawn a python process using winpexpect, but test = winpexpect.winspawn('python.exe') is failing to do so. The command itself does not throw an error, but when I try test.expect('>>>') the process is timing out.

This behavior is not observed when I try to spawn a cmd.exe or some other process.

Can a python process be spawned using winpexpect? Am I doing some thing wrong?

PS: Python path is added to my PATH environment variable


Solution

  • As Sebastian has suggested, forcing the process to interactive mode helped.

    test = winpexpect.winspawn('python.exe -i')