Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python curses Redirection is not supported

I am trying to use Curses in PyDev in Eclipse in Win7.

I have installed Python 3.2 (64bit) and curses-2.2.win-amd64-py3.2. When I input the following testing codes into PyDev:

import curses  

myscreen = curses.initscr()
myscreen.border(0)
myscreen.addstr(12, 25, "Python curses in action!")    
myscreen.refresh()
myscreen.getch()     
curses.endwin()

It did not show any syntax error, so I think the curses was installed correctly.

However, when I ran it as Python Run, the output showed: Redirection is not supported. I do not know where this problem comes from. I googled a lot but can't find related information.

like image 968
shaosh Avatar asked May 24 '13 17:05

shaosh


2 Answers

Recent PyCharm versions (I am currently running 2017.2, not sure when this option was added, or if it has been there the entire time) have the option "Emulate terminal in output console". Curses works with this option checked.

enter image description here

like image 137
codeape Avatar answered Sep 19 '22 14:09

codeape


You cannot expect to use curses with a non-terminal.

Probably you get this because you are running the script from inside an IDE, like PyCharm or any other.

All IDEs do provide consoles that are not terminals, so that's where the problem comes from.

like image 45
sorin Avatar answered Sep 20 '22 14:09

sorin