I'm trying to run a basic Pexpect script:
import pexpect
ftp_process = pexpect.spawn('ftp')
ftp_process.interact()
When the code is run directly from a terminal, the code works as expected. If I run the code using PyCharm's run/debug I get the following error:
Traceback (most recent call last):
File "/path/to/code/test.py", line 3, in <module>
ftp_process.interact()
File "/usr/local/lib/python3.4/site-packages/pexpect/__init__.py", line 1645, in interact
mode = tty.tcgetattr(self.STDIN_FILENO)
termios.error: (25, 'Inappropriate ioctl for device')
It seems that how Pexpect interacts with PyCharm's run/debug window doesn't work by default. Is there some way to remedy this with a specific PyCharm setting? If not, is there some other way to work around this?
EDIT
The code above is simply a shortened example which results in the problem. The other abilities of pexpect (such as expect()
, sendline()
, etc) are still desired.