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

Linuxguy123 linuxguy123 at gmail.com
Fri Jan 30 11:03:04 EST 2009


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:

$ python
Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import sys
>>> import pexpect
>>> child = pexpect.spawn('/bin/bash')
>>> child.interact()
[xxx at localhost ~]$ ls
		<outputs file list here...>
[xxx at localhost ~]$ exit
>>>
>>>

Why doesn't it run under Eclipse and how do I fix it so it does ?

Thanks




More information about the Python-list mailing list