From a7bc5fd1ad60d280368965080ccb2424e3ed512a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20HERVIER?= Date: Wed, 2 Aug 2017 11:11:29 +0200 Subject: [PATCH] UnicodeDecodeError when downloading mghdb Downloading the mghdb give the following error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 1209: ordinal not in range(128) import wfdb wfdb.dldatabase('mghdb', os.getcwd(), records = 'all', annotators = 'all' , keepsubdirs = True, overwrite = False) It s look like text isn t just ascii, but latin 1. --- wfdb/readwrite/downloads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfdb/readwrite/downloads.py b/wfdb/readwrite/downloads.py index 345279eb..4bfe91d9 100644 --- a/wfdb/readwrite/downloads.py +++ b/wfdb/readwrite/downloads.py @@ -15,7 +15,7 @@ def streamheader(recordname, pbdir): r.raise_for_status() # Get each line as a string - filelines = r.content.decode('ascii').splitlines() + filelines = r.content.decode('iso-8859-1').splitlines() # Separate content into header and comment lines headerlines = []