pexpect.spawn will try to find the absolute path to the command with the 'which' function. In this function it is only checked that discovered files have the executable bit set. I think, it should also be checked whether it is an actual file (or a directory).
At the moment it is possible that a directory in the search path hides an executable with the same name resulting in an OSError exception ('permission denied').
This has been addressed on Github, so I'm closing this issue.
https://github.com/pexpect/pexpect/pull/62