6

I'm working on a script that runs fine from the normal bash shell in Ubuntu 14.04. However when it is run from within PyCharm I get:

termios.error: (25, 'Inappropriate ioctl for device')

All it takes is this code:

from prompt_toolkit import prompt

text = prompt('Give me some input: ')
print('You said: %s' % text)

from the Python Prompt Toolkit "Getting Started" example in https://github.com/jonathanslenders/python-prompt-toolkit which is the only installed package in a python 3.4 virtual environment.

Since this is how the integrated debugger in PyCharm runs, how can I fix it so the debugger runs properly?

2 Answers 2

4

I received 'Inappropriate ioctl for device' in PyCharm (but not the normal shell) because I was calling fzf, which pops up a graphical menu in the terminal. This was fixed with Pycharm -> Run -> Edit configurations -> Emulate terminal in output console

enter image description here

1

You can attach the Pycharm debugger to process executed outside of Pycharm. Go to Tools -> Attach to process and choose the correct process. See Pycharm docs

3
  • 1
    Thanks for taking time to answer my question. I've since moved over to Ubuntu 16.04 where this issue have not reappeared.
    – tsvenson
    Commented Sep 27, 2016 at 11:54
  • Interesting, I don't see how Ubuntu version is related to this. Maybe you are also using newer version of Pycharm? But it's still good to know about possibility to attach debugger, because Pycharm console sometimes doesn't behave as real terminal. Nice example is autocomplete feature in cmd module.
    – J91321
    Commented Sep 27, 2016 at 12:18
  • 1
    Yes, using the latest 2016.x edition, plus that Ubuntu 16.04 also meant upgrade from Python 3.4 to 3.5, which was one of my main reasons to upgrade.
    – tsvenson
    Commented Sep 27, 2016 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.