Merge pull request #145 from Pawka/f-out
Fix TypeError when printing color codes to stdout
This commit is contained in:
commit
86355e6f72
1 changed files with 8 additions and 2 deletions
|
|
@ -70,7 +70,13 @@ class Display:
|
||||||
self.logger.info(str(message)) # TODO: "utf-8", "replace"
|
self.logger.info(str(message)) # TODO: "utf-8", "replace"
|
||||||
|
|
||||||
def out(self, put):
|
def out(self, put):
|
||||||
sys.stdout.write("\r" + " " * self.columns + "\r" + str(put, "utf-8", "replace") + "\n")
|
pattern = "\r{!s}\r{!s}\n"
|
||||||
|
try:
|
||||||
|
s = pattern.format(
|
||||||
|
" " * self.columns, str(put, "utf-8", "replace"))
|
||||||
|
except TypeError:
|
||||||
|
s = pattern.format(" " * self.columns, put)
|
||||||
|
sys.stdout.write(s)
|
||||||
|
|
||||||
def info(self, message, state=False):
|
def info(self, message, state=False):
|
||||||
self.log(message)
|
self.log(message)
|
||||||
|
|
@ -417,7 +423,7 @@ class SafariBooks:
|
||||||
|
|
||||||
if update_referer:
|
if update_referer:
|
||||||
# TODO Update Referer HTTP Header
|
# TODO Update Referer HTTP Header
|
||||||
# TODO How about Origin?
|
# TODO How about Origin?
|
||||||
self.HEADERS["referer"] = response.request.url
|
self.HEADERS["referer"] = response.request.url
|
||||||
|
|
||||||
if response.is_redirect and perfom_redirect:
|
if response.is_redirect and perfom_redirect:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue