From cedd12232b4ab1d286fc43ca31a1fb4dc79564a5 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Tue, 16 Jul 2019 17:04:04 +0300 Subject: [PATCH 1/4] Fixed encoding trouble --- camelot/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camelot/core.py b/camelot/core.py index b7a02b1..3b0a5ad 100644 --- a/camelot/core.py +++ b/camelot/core.py @@ -632,7 +632,7 @@ class Table(object): """ html_string = self.df.to_html(**kwargs) - with open(path, "w") as f: + with open(path, "w", encoding="utf-8") as f: f.write(html_string) def to_sqlite(self, path, **kwargs): From 5b7afe4d299d255c4b84b01304bcb26315c9679a Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Mon, 22 Jul 2019 21:51:32 +0000 Subject: [PATCH 2/4] Compatibility to python 2.7 --- camelot/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/camelot/core.py b/camelot/core.py index 3b0a5ad..8d12a04 100644 --- a/camelot/core.py +++ b/camelot/core.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from io import open import os import sqlite3 import zipfile From d1db9bd4432e363822b86d56ea309d5fc5a3d54f Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Tue, 23 Jul 2019 06:34:07 +0000 Subject: [PATCH 3/4] Fixing 2.7 compatibility again --- camelot/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/camelot/core.py b/camelot/core.py index 8d12a04..c4bd4d4 100644 --- a/camelot/core.py +++ b/camelot/core.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import from io import open import os import sqlite3 From d8c6d0eb77a6535f2fb0032ae874a1efcdb813c2 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Tue, 23 Jul 2019 06:42:44 +0000 Subject: [PATCH 4/4] Adding encoding to `open` in`to_json` --- camelot/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camelot/core.py b/camelot/core.py index c4bd4d4..fffa262 100644 --- a/camelot/core.py +++ b/camelot/core.py @@ -599,7 +599,7 @@ class Table(object): kw = {"orient": "records"} kw.update(kwargs) json_string = self.df.to_json(**kw) - with open(path, "w") as f: + with open(path, "w", encoding="utf-8") as f: f.write(json_string) def to_excel(self, path, **kwargs):