Fix behavior with unavailable formatters
Turns out defaultdict and str.format(**d) don't work well together; using string.Formatter().vformat() instead. My bad.
This commit is contained in:
parent
e45665c912
commit
08db5463cd
@ -17,6 +17,7 @@ import os
|
|||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
@ -570,7 +571,7 @@ class YoutubeDL(object):
|
|||||||
tmpl = compat_expanduser(outtmpl)
|
tmpl = compat_expanduser(outtmpl)
|
||||||
# Backwards compatibility fix (deprecated): %(foo)s -> {foo}, %% -> %
|
# Backwards compatibility fix (deprecated): %(foo)s -> {foo}, %% -> %
|
||||||
tmpl = re.sub(r'(?<!%)((?:%)*)\1%\(([^)]*)\)s', r'\1{\2}', tmpl).replace('%%','%')
|
tmpl = re.sub(r'(?<!%)((?:%)*)\1%\(([^)]*)\)s', r'\1{\2}', tmpl).replace('%%','%')
|
||||||
filename = sanitize_path(tmpl.format(**template_dict))
|
filename = sanitize_path(string.Formatter().vformat(tmpl, None, template_dict))
|
||||||
# Temporary fix for #4787
|
# Temporary fix for #4787
|
||||||
# 'Treat' all problem characters by passing filename through preferredencoding
|
# 'Treat' all problem characters by passing filename through preferredencoding
|
||||||
# to workaround encoding issues with subprocess on python2 @ Windows
|
# to workaround encoding issues with subprocess on python2 @ Windows
|
||||||
|
Loading…
x
Reference in New Issue
Block a user