aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-03-18 14:27:42 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-03-18 14:27:42 +0100
commite68301af21310864546b97cee77c720cf307a502 (patch)
tree89a1a92533916164a8d60eda62d6499429e7c4ab /youtube_dl/utils.py
parent17286a96f233426506f08d8d6664af59f0973200 (diff)
Fix getpass on Windows (Fixes #2547)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 3cf29e63a..7e7d1e8b6 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -6,6 +6,7 @@ import ctypes
import datetime
import email.utils
import errno
+import getpass
import gzip
import itertools
import io
@@ -1279,3 +1280,12 @@ def parse_xml(s):
parser = xml.etree.ElementTree.XMLParser(target=TreeBuilder())
kwargs = {'parser': parser} if sys.version_info >= (2, 7) else {}
return xml.etree.ElementTree.XML(s.encode('utf-8'), **kwargs)
+
+
+if sys.version_info < (3, 0) and sys.platform == 'win32':
+ def compat_getpass(prompt, *args, **kwargs):
+ if isinstance(prompt, compat_str):
+ prompt = prompt.encode(getpreferredencoding())
+ return getpass.getpass(prompt, *args, **kwargs)
+else:
+ compat_getpass = getpass.getpass