aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/FileDownloader.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2012-12-20 13:13:24 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2012-12-20 13:13:24 +0100
commitf4bfd65ff2bfce77a6953281c037ca8e516b7648 (patch)
tree1a2347c7039d9acd6539ca7187dd0d7fbe10f8dc /youtube_dl/FileDownloader.py
parent3cc687d486c5fc4710b6fdec4340b7635cec91c9 (diff)
Correct JSON writing (Closes #596)
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r--youtube_dl/FileDownloader.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py
index e8c62ce07..be70ec755 100644
--- a/youtube_dl/FileDownloader.py
+++ b/youtube_dl/FileDownloader.py
@@ -454,9 +454,8 @@ class FileDownloader(object):
self.trouble(u'ERROR: No JSON encoder found. Update to Python 2.6+, setup a json module, or leave out --write-info-json.')
return
try:
- with io.open(encodeFilename(infofn), 'w', 'utf-8') as infof:
- json_info_dict = dict((k, v) for k,v in info_dict.items() if not k in ['urlhandle'])
- json.dump(json_info_dict, infof)
+ json_info_dict = dict((k, v) for k,v in info_dict.items() if not k in ['urlhandle'])
+ write_json_file(json_info_dict, encodeFilename(infofn))
except (OSError, IOError):
self.trouble(u'ERROR: Cannot write metadata to JSON file ' + infofn)
return