From f38aa1a254bbcd76149f629ff29737c0e7f7272a Mon Sep 17 00:00:00 2001 From: Christian Tremblay Date: Tue, 8 Dec 2015 12:11:16 -0500 Subject: [PATCH] Isolated xlwings from Travis (only available on Windows or OS X) Signed-off-by: Christian Tremblay --- BAC0/core/devices/Device.py | 16 +++++++++++----- requirements.txt | 3 +-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/BAC0/core/devices/Device.py b/BAC0/core/devices/Device.py index b2b4379f..49886077 100644 --- a/BAC0/core/devices/Device.py +++ b/BAC0/core/devices/Device.py @@ -19,8 +19,12 @@ import pandas as pd from datetime import datetime -from xlwings import Workbook, Sheet, Range, Chart - +try: + from xlwings import Workbook, Sheet, Range, Chart + _XLWINGS = True +except ImportError: + print('xlwings not installed. If using Windows or OSX, install to get more features.') + _XLWINGS = False class Device(): """ @@ -338,10 +342,12 @@ def save_to_excel(self): his['Notes'] = self.notes df = pd.DataFrame(his).fillna(method='ffill').fillna(method='bfill') - - wb = Workbook() - Range('A1').value = df + if _XLWINGS: + wb = Workbook() + Range('A1').value = df + else: + df.to_csv() def __setitem__(self, point_name, value): """ diff --git a/requirements.txt b/requirements.txt index 778ff0c3..2abceb6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ pandas>=0.14 numpy>=1.9 bacpypes>=0.13 -bokeh>=0.10.0 -xlwings>=0.4 \ No newline at end of file +bokeh>=0.10.0 \ No newline at end of file