Why doesn't this work in Eclipse ? (Simple pexpect code that works in bash)

Gary Duzan gduzan at gmail.com
Fri Jan 30 12:21:49 EST 2009


On Jan 30, 11:03 am, Linuxguy123 <linuxguy... at gmail.com> wrote:
> I'm trying to build a small Python app in Eclipse under Fedora 10.
>
> I have the following code:
>
> import os
> import sys
> import pexpect
>
> child = pexpect.spawn('/bin/bash')
> child.interact()
>
> When I run it in Eclipse, I get:
>
> Traceback (most recent call last):
>   File "/home/xxx/workspace/FixPermissions/src/default/main.py", line
> 56, in <module>
>     child.interact()
>   File "/usr/lib/python2.5/site-packages/pexpect.py", line 1489, in
> interact
>     mode = tty.tcgetattr(self.STDIN_FILENO)
> termios.error: (22, 'Invalid argument')
>
> Yet if I run it in a bash shell, it works:
>
> [ ... ]
>
> Why doesn't it run under Eclipse and how do I fix it so it does ?

   That code assumes the stdin of the parent is a real (or possibly
pseudo-) terminal, which appears not to be the case for programs run
through Eclipse.

                                             Gary Duzan




More information about the Python-list mailing list