projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1deb710
)
[utils] Add error_to_str
author
Sergey M․
<dstftw@gmail.com>
Sat, 19 Dec 2015 23:26:47 +0000
(
05:26
+0600)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 19 Dec 2015 23:26:47 +0000
(
05:26
+0600)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index 5b396ede8dd97aa441b134edf57146c4b0ab07a7..6d31197606bf67bc2686b24a956a21a2536abd73 100644
(file)
--- a/
youtube_dl/utils.py
+++ b/
youtube_dl/utils.py
@@
-1806,6
+1806,15
@@
def args_to_str(args):
return ' '.join(shlex_quote(a) for a in args)
+def error_to_str(err):
+ err_str = str(err)
+ # On python 2 error byte string must be decoded with proper
+ # encoding rather than ascii
+ if sys.version_info[0] < 3:
+ err_str = err_str.decode(preferredencoding())
+ return err_str
+
+
def mimetype2ext(mt):
_, _, res = mt.rpartition('/')