From 8b7109d882204ab0faaabfae9a950ceb1c905b1e Mon Sep 17 00:00:00 2001 From: cgohlke Date: Sat, 11 Jan 2014 15:04:01 -0800 Subject: [PATCH] Fix saving EPS to open file objects on Python 2.x Fix issue #470 and #479 --- PIL/EpsImagePlugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PIL/EpsImagePlugin.py b/PIL/EpsImagePlugin.py index a8706b05f..f725297fd 100644 --- a/PIL/EpsImagePlugin.py +++ b/PIL/EpsImagePlugin.py @@ -350,7 +350,9 @@ def _save(im, fp, filename, eps=1): pass base_fp = fp - fp = io.TextIOWrapper(NoCloseStream(fp), encoding='latin-1') + fp = NoCloseStream(fp) + if sys.version_info[0] > 2: + fp = io.TextIOWrapper(fp, encoding='latin-1') if eps: #