Python Forum
shutils.get_terminal_size()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
shutils.get_terminal_size()
#1
a while back someone suggested using shutil.get_terminal_size() instead of doing syscalls to get the terminal size info. my objection at the time was that it didn't work on all versions. what i ended up coding was using it under try: and doing the syscalls under except:.

but i just recently saw that shutil.get_terminal_size() uses environment variables. this is wrong since the terminal size can change. despite it actually getting the correct answer when the size changes, because it is documented to get the size from environment variables, i do not want the risk that some day in the future it might be made to conform to documentation. and i just can't trust os.get_terminal_size(), either. so i'm switching back to the syscall way. if they fix the documentation, then i can use those modules to get the terminal size.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
shutils.get_terminal_size() - by Skaperen - Nov-28-2018, 10:01 PM
RE: shutils.get_terminal_size() - by Gribouillis - Nov-28-2018, 10:21 PM
RE: shutils.get_terminal_size() - by nilamo - Nov-28-2018, 10:22 PM
RE: shutils.get_terminal_size() - by wavic - Nov-29-2018, 12:37 AM
RE: shutils.get_terminal_size() - by Skaperen - Nov-29-2018, 01:32 AM
RE: shutils.get_terminal_size() - by wavic - Nov-29-2018, 08:35 AM
RE: shutils.get_terminal_size() - by nilamo - Nov-29-2018, 03:40 PM
RE: shutils.get_terminal_size() - by Skaperen - Dec-04-2018, 08:48 AM
RE: shutils.get_terminal_size() - by DeaD_EyE - Dec-04-2018, 12:33 PM
RE: shutils.get_terminal_size() - by Skaperen - Dec-07-2018, 03:46 AM
RE: shutils.get_terminal_size() - by Skaperen - Dec-10-2018, 05:37 AM
RE: shutils.get_terminal_size() - by DeaD_EyE - Dec-10-2018, 08:30 AM

Forum Jump:

User Panel Messages

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