From a18b1d7adbac21f55b5acaea8f5bb3a1a4bcfcbe Mon Sep 17 00:00:00 2001 From: llllllllll Date: Wed, 7 Oct 2015 12:09:35 -0400 Subject: [PATCH] ENH: PY2 compat with blaze loader --- zipline/pipeline/loaders/blaze.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zipline/pipeline/loaders/blaze.py b/zipline/pipeline/loaders/blaze.py index 9336a8a8..887263d1 100644 --- a/zipline/pipeline/loaders/blaze.py +++ b/zipline/pipeline/loaders/blaze.py @@ -144,7 +144,7 @@ from numpy.lib.stride_tricks import as_strided from odo import odo import pandas as pd from toolz import flip, memoize, compose, complement, identity -from six import with_metaclass +from six import with_metaclass, PY2 from ..data.dataset import DataSet, Column @@ -298,6 +298,12 @@ def new_dataset(expr, deltas): name = expr._name if expr._name is None: name = next(_new_names) + + # unicode is a name error in py3 but the branch is only hit + # when we are in python 2. + if PY2 and isinstance(name, unicode): # noqa + name = name.encode('utf-8') + return type(name, (DataSet,), columns)