From 64e1d228208bc60664af42c6384e534958c355f9 Mon Sep 17 00:00:00 2001 From: Valentin Deville Date: Sat, 6 Jan 2018 21:55:11 +0100 Subject: [PATCH] Fix encoding Fix bug when watched file contains characters like \r\n etc.. --- tail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tail.py b/tail.py index 24f69d0..fb9915a 100644 --- a/tail.py +++ b/tail.py @@ -46,7 +46,7 @@ def follow(self, s=1): Arguments: s - Number of seconds to wait between each iteration; Defaults to 1. ''' - with open(self.tailed_file) as file_: + with open(self.tailed_file, encoding='utf-8') as file_: # Go to the end of file file_.seek(0,2) while True: