Python Forum
Curses could not find terminal
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Curses could not find terminal
#11
Strange, if I run it on my Raspberry Pi (Stretch) from Geany IDE it opens a new terminal (multiple terminals if I keep executing it), however if I run it from the command line, it doesn't open a new terminal, just prints to the existing terminal:

pi@raspberrypi:~/Documents/Python $ python3.6 term_example.py
Hello from term-example
pi@raspberrypi:~/Documents/Python $ 
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#12
@sparkz_alot It is by design. I wrote this program because the OP wants to use IDLE3 and still write a program that needs a terminal to run. I chose to launch a new terminal if the call sys.stdout.fileno() fails, indicating that sys.stdout is not the usual output stream. From IDLE3 or Geany, this will launch a new terminal. It may fail in other IDEs. It is easy to change the code to always launch a new terminal unless the --noterminal switch is on.
Reply
#13
(Jan-05-2018, 04:23 PM)Gribouillis Wrote: It is easy to change the code to always launch a new terminal

Not necessary. Thanks for the clarification, I should have been paying more attention :-\
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#14
There may be more robust ways to detect if the process uses a terminal. With the psutil module one can write
import psutil
proc = psutil.Process()
if proc.terminal() is None:
    print("This process doesn't use a terminal")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I want to be able to scroll up in curses to see previous text. Caiden 1 776 Jul-28-2023, 01:15 PM
Last Post: deanhystad
  curses issue otalado 2 2,758 Jun-29-2021, 02:07 PM
Last Post: tmz
  How to make curses.border() use A_BOLD atttribute? pjfarley3 0 4,850 Feb-03-2021, 11:22 PM
Last Post: pjfarley3
  Curses script doesn't work wavic 1 4,167 Jan-08-2021, 09:11 PM
Last Post: wavic
  Why aren't all curses panel functions supported in python curses.panel? pjfarley3 2 2,678 Jul-22-2020, 11:08 PM
Last Post: pjfarley3
  curses library autompav96 2 2,904 Mar-02-2019, 02:12 AM
Last Post: woooee
  curses key codes not working jgrillout 0 3,032 Feb-11-2019, 01:46 AM
Last Post: jgrillout
  Pretty table and curses? MuntyScruntfundle 0 2,900 Oct-16-2018, 10:22 AM
Last Post: MuntyScruntfundle
  curses.initscr doesn't work zaphod424 3 9,820 Feb-28-2018, 12:36 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020