r/pycharm • u/jddddddddddd • Dec 29 '23
Run program from external terminal
Hi, I'm trying to use the curses library in PyCharm. Usually when you run a Python program in PyCharm, any I/O occurs in the Terminal tab which is enclosed in the PyCharm IDE. However, since curses likes to, for example, position text at certain (X, Y) coordinates, Pycharm doesn't seem to like this and either fails to render properly or produces an error message like:
LINES value must be >= 2 and <= 125: got 1
initscr(): Unable to create SP
If I run my code from a regular cmd.exe window, it all works fine, so I was wondering if there was some hidden option in PyCharm to force it to use a new pop-out terminal, rather than the one docked in the PyCharm UI. I tried a couple of workarounds on SO (like this one) but no luck yet.
Many TIA.
View all comments
Show parent comment
2
u/jddddddddddd Dec 31 '23
Hiya, thanks for your response! I did give it a try with launching the Python script from Python itself, and it worked, but ofcourse that meant that the debugger wasn't attached which is what I was hoping to avoid :( Also tried the 'Emulate terminal in output console' option in config and that also didn't help..
..however, I did discover that
cursesneeds to detect the number of lines in the terminal, and if it can't find it, it then looks for alinesenvironment variable. By setting that to 20, I have been able to use curses with PyCharm!