From d00edbcf04208338512819d2bac7cafa92a408e6 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin Date: Sun, 23 Mar 2014 15:44:40 -0400 Subject: [PATCH] BUG: check that self.logger exists `self.logger` is initialized as `None` and there is no guarantee that users have set it, so check that it exists before trying to pass messages to it. --- zipline/algorithm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zipline/algorithm.py b/zipline/algorithm.py index 2002abac..56cde705 100644 --- a/zipline/algorithm.py +++ b/zipline/algorithm.py @@ -471,7 +471,8 @@ class TradingAlgorithm(object): zero_message = "Price of 0 for {psid}; can't infer value".format( psid=sid ) - self.logger.debug(zero_message) + if self.logger: + self.logger.debug(zero_message) # Don't place any order return else: