Fix issues with python 2

This commit is contained in:
CorpNewt 2024-07-14 14:38:14 -05:00 committed by GitHub
parent 32aef451de
commit 738e324f56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -222,9 +222,10 @@ class Utils:
# Header drawing method # Header drawing method
def head(self, text = None, width = 55): def head(self, text = None, width = 55):
if not self.interactive: if not self.interactive:
print(text, file=sys.stderr) sys.stderr.write(str(text)+"\n")
sys.stderr.flush()
return return
if text == None: if text is None:
text = self.name text = self.name
self.cls() self.cls()
print(" {}".format("#"*width)) print(" {}".format("#"*width))
@ -245,7 +246,8 @@ class Utils:
if self.interactive: if self.interactive:
print(text) print(text)
else: else:
print(text, file=sys.stderr) sys.stderr.write(str(text)+"\n")
sys.stderr.flush()
def resize(self, width, height): def resize(self, width, height):
print('\033[8;{};{}t'.format(height, width)) print('\033[8;{};{}t'.format(height, width))