handle attribute error when stdout does not habe encoding attribute (ie xbmcout)
This commit is contained in:
parent
3540bfe2fc
commit
21affed283
1 changed files with 4 additions and 1 deletions
|
|
@ -177,7 +177,10 @@ class Application(object):
|
|||
def guess_encoding(self, stdio=None):
|
||||
if stdio is None:
|
||||
stdio = self.stdout
|
||||
encoding = stdio.encoding or locale.getpreferredencoding()
|
||||
try:
|
||||
encoding = stdio.encoding or locale.getpreferredencoding()
|
||||
except AttributeError:
|
||||
encoding = None
|
||||
# ASCII or ANSII is most likely a user mistake
|
||||
if not encoding or encoding.lower() == 'ascii' or encoding.lower().startswith('ansi'):
|
||||
encoding = 'UTF-8'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue