diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2012-12-20 13:25:54 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2012-12-20 13:25:54 +0100 |
commit | bfa6389b74866d5406f68a06c589193b12f83c38 (patch) | |
tree | e5ee3d1409e27cef4eb7c4eab04ad4a1971649fb /youtube_dl | |
parent | 9b14f51a3eaf5b63dad288e092d8a083dd931ceb (diff) |
Clean up legacy code
Diffstat (limited to 'youtube_dl')
-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 a7f3e1064..a861086c3 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -421,11 +421,8 @@ class FileDownloader(object): try: descfn = filename + u'.description' self.report_writedescription(descfn) - descfile = open(encodeFilename(descfn), 'wb') - try: - descfile.write(info_dict['description'].encode('utf-8')) - finally: - descfile.close() + with io.open(encodeFilename(descfn), 'w', encoding='utf-8') as descfile: + descfile.write(info_dict['description']) except (OSError, IOError): self.trouble(u'ERROR: Cannot write description file ' + descfn) return |