I have a python script which uses
size = os.popen('stty size', 'r').read().split()to get the terminal window size so I can print text nicely. My problem arises when I have to run this python script through a bash script. I have a bash script which calls rosrun on this python script in the background (using &), and I get the error -
stty: 'standard input': Inappropriate ioctl for deviceAfter looking around a bit, I understand this is because stty requires a terminal (or pseudo-terminal) and the bash script I am running is not providing it. I cannot use sudo as ros commands cannot be run with root user.
Using script -q -c command doesn't help either. Is there some way that I can fix this issue without having to change os.popen command in the python script to an alternative? Currently, I am thinking of perhaps adding a print before the os.popen and using expect in the bash script.