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

L

Linuxguy123

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.[xxx@localhost ~]$ ls

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

Thanks
 
G

Gary Duzan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top