Fix error display bug from previous commit, reset colors & print new line after displaying file
This commit is contained in:
parent
814fef2ba3
commit
cf1da03eeb
1 changed files with 5 additions and 3 deletions
8
pat.py
8
pat.py
|
@ -29,9 +29,9 @@ for arg in argv[1:]:
|
||||||
read_result = file.read(bytes_to_read)
|
read_result = file.read(bytes_to_read)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(
|
print(
|
||||||
f"Error \
|
"Error "
|
||||||
{f'reading {file.name}' if 'file' in globals() else 'opening file'}\
|
+ (f"reading {file.name}" if "file" in globals() else "opening file")
|
||||||
: {e}",
|
+ f": {e}",
|
||||||
file=stderr,
|
file=stderr,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
@ -61,3 +61,5 @@ for arg in argv[1:]:
|
||||||
|
|
||||||
print("\x1b[38;2;%d;%d;%dm%s" % (red, green, blue, char), end="")
|
print("\x1b[38;2;%d;%d;%dm%s" % (red, green, blue, char), end="")
|
||||||
index += step
|
index += step
|
||||||
|
|
||||||
|
print("\x1b[0m")
|
||||||
|
|
Loading…
Reference in a new issue