diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2012-12-20 21:28:32 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2012-12-20 21:28:32 +0100 |
commit | a7c0f8602e91cc96962c7eade10860b61afc3728 (patch) | |
tree | 01182f741a7b474d91e565e4beb91cc577e726d8 /youtube_dl/FileDownloader.py | |
parent | 21a9c6aaac074b3ad85adc55818573e7971f8043 (diff) | |
parent | 162e3c52616a72f4ddc11b0e5de0f2425e512896 (diff) |
Merge branch 'master' of github.com:rg3/youtube-dl
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r-- | youtube_dl/FileDownloader.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index a861086c3..d9a4ecd3a 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -433,11 +433,8 @@ class FileDownloader(object): try: srtfn = filename.rsplit('.', 1)[0] + u'.srt' self.report_writesubtitles(srtfn) - srtfile = open(encodeFilename(srtfn), 'wb') - try: - srtfile.write(info_dict['subtitles'].encode('utf-8')) - finally: - srtfile.close() + with io.open(encodeFilename(srtfn), 'w', encoding='utf-8') as srtfile: + srtfile.write(info_dict['subtitles']) except (OSError, IOError): self.trouble(u'ERROR: Cannot write subtitles file ' + descfn) return |