Issue 32463: problems with shutil.py and os.get_terminal_size
Created on 2017-12-31 11:12 by Dhruve, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg309276 - (view) | Author: Nick McElwaine (Dhruve) | Date: 2017-12-31 11:12 | |
os.get_terminal_size() fails with () or (0) or (1) shutil.sys fails calling it with (sys.__stdout__.fileno()) because sys.__stdout__ is type None |
|||
| msg309279 - (view) | Author: Eryk Sun (eryksun) * ![]() |
Date: 2017-12-31 12:18 | |
The 3.5 branch only gets security fixes at this point. Consider upgrading to 3.6. That said, this shouldn't be a problem with shutil.get_terminal_size() in 3.5. It handles AttributeError, ValueError, and OSError by returning the `fallback` size. And it's expected that `os.get_terminal_size(1)` will fail if there's no attached console. |
|||
| msg317024 - (view) | Author: Berker Peksag (berker.peksag) * ![]() |
Date: 2018-05-18 12:05 | |
Thanks for the report. I agree with Eryk. os.get_terminal_size() is a low-level function. shutil.get_terminal_size() should be used as documented at https://docs.python.org/3/library/os.html#os.get_terminal_size shutil.get_terminal_size() is the high-level function which should normally be used, os.get_terminal_size is the low-level implementation. |
|||
| msg317219 - (view) | Author: Nick McElwaine (Dhruve) | Date: 2018-05-21 08:17 | |
Thankyou for clearing that up! On 18 May 2018 at 13:05, Berker Peksag <report@bugs.python.org> wrote: > > Berker Peksag <berker.peksag@gmail.com> added the comment: > > Thanks for the report. I agree with Eryk. os.get_terminal_size() is a > low-level function. shutil.get_terminal_size() should be used as documented > at https://docs.python.org/3/library/os.html#os.get_terminal_size > > shutil.get_terminal_size() is the high-level function which should > normally be used, os.get_terminal_size is the low-level > implementation. > > ---------- > nosy: +berker.peksag > resolution: -> not a bug > stage: -> resolved > status: open -> closed > > _______________________________________ > Python tracker <report@bugs.python.org> > <https://bugs.python.org/issue32463> > _______________________________________ > |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:56 | admin | set | github: 76644 |
| 2018-05-21 08:17:16 | Dhruve | set | messages: + msg317219 |
| 2018-05-18 12:05:37 | berker.peksag | set | status: open -> closed nosy:
+ berker.peksag resolution: not a bug |
| 2017-12-31 12:18:32 | eryksun | set | nosy:
+ eryksun messages: + msg309279 components: + Library (Lib) |
| 2017-12-31 11:12:31 | Dhruve | create | |

