Facial-Expression-Recognition.Pytorch icon indicating copy to clipboard operation
Facial-Expression-Recognition.Pytorch copied to clipboard

An error about stty

Open jiangtianyise opened this issue 1 year ago • 3 comments

_, term_width = os.popen('stty size', 'r').read().split() ValueError: not enough values to unpack (expected 2, got 0) Can you tell me how to fix the problem?

jiangtianyise avatar Jul 23 '23 02:07 jiangtianyise

indicates that the os.popen('stty size', 'r').read().split() line is not returning the expected output. This is likely because the stty size command did not return the expected result.The stty size command is used to get the size of the terminal window in rows and columns. It should return something like 24 80 to represent a terminal with 24 rows and 80 columns. However, if your terminal or environment does not support the stty size command, it will return an empty string or something different, leading to the error you encountered.

To fix the problem, you can handle cases where the stty size command does not return the expected output. You can do this by using a try-except block to catch the error and provide a default value for term_width and term_height. Here's an example of how to do it:

** import os

try: term_height, term_width = os.popen('stty size', 'r').read().split() except ValueError: # Handle the case where 'stty size' did not return the expected result term_height = 24 # Provide a default value term_width = 80 # Provide a default value

**

shreyakjr10 avatar Oct 16 '23 04:10 shreyakjr10

Thank you very much,I have fixed the issue

jiangtianyise avatar Nov 03 '23 10:11 jiangtianyise

非常感谢,我已经解决了这个问题

请问怎么解决的呀 我也是有这个问题

yichangjianduan avatar Apr 29 '24 15:04 yichangjianduan