Python Forum
what version ... os.get_terminal_geometry() ...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what version ... os.get_terminal_geometry() ...
#6
i prefer, where possible, to avoid running another process just to get a little bit of information. so i like the idea of doing system or library (module in python) calls. i have invoked stty often in my bash scripts. but if i don't have to in python, i like that. in on script i needed the host's IP address. but i needed it soon, so i invoked the ifconfig command and got it from there. not all scripts do things the same way. but if i do on thing quite a lot, i make it into a function or module or command or whatever it needs.

(Jul-15-2018, 09:41 AM)stranac Wrote: Looks like os.get_terminal_size() was added in python 3.3.
It also looks like you should be using shutil.get_terminal_size() instead.

my get_terminal_geometry() function would have had a gap of 3.0 to 3.2 since it had code to get the geometry itself in version 2. now i will test for version 3.3 or if os is already imported, see if 'get_terminal_size' in dir(os).

so, why should i be using shutil.get_terminal_size() instead?
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
RE: what version ... os.get_terminal_geometry() ... - by Skaperen - Jul-18-2018, 07:35 AM

Forum Jump:

User Panel Messages

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