From f3d6e3db8fe96ee2aabe8334e6ed159d5f5bf56e Mon Sep 17 00:00:00 2001 From: Chris Redpath Date: Thu, 1 Nov 2018 18:07:57 +0000 Subject: [PATCH] trappy/cache: Store the csv in utf-8 charset explicitly When we load the files from trace-cmd output, we explicitly choose to load them using utf-8. This means we may have characters in our trace which cannot be represented in ascii, which makes pandas upset when we try to store the parsed dataframes in the csv cache. This is not an issue for Python3 versions, as the to_csv method defaults to utf-8, whilst the Python2 to_csv method defaults to ascii. Signed-off-by: Chris Redpath --- trappy/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trappy/base.py b/trappy/base.py index 385c8aac..55f0dca4 100644 --- a/trappy/base.py +++ b/trappy/base.py @@ -298,7 +298,7 @@ def write_csv(self, fname): :param fname: The name of the CSV file :type fname: str """ - self.data_frame.to_csv(fname) + self.data_frame.to_csv(fname, encoding='utf-8') def read_csv(self, fname): """Read the csv data into a DataFrame