Skip to content

Commit

Permalink
fix(init): Only log exceptions when python version is 3 or higher
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Aug 30, 2024
1 parent c0e5b6b commit c0d314a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ladybug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import importlib
import pkgutil
import sys

# set up the logger
logger = get_logger(__name__)
Expand All @@ -20,6 +21,7 @@
try:
extensions[name] = importlib.import_module(name)
except Exception:
logger.exception('Failed to import {0}!'.format(name))
if (sys.version_info >= (3, 0)):
logger.exception('Failed to import {0}!'.format(name))
else:
logger.info('Successfully imported Ladybug plugin: {}'.format(name))
2 changes: 1 addition & 1 deletion ladybug/analysisperiod.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def __repr__(self):
self.timestep)

def __key(self):
return(self.st_time, self.end_time, self.timestep, self.is_leap_year)
return (self.st_time, self.end_time, self.timestep, self.is_leap_year)

def __hash__(self):
return hash(self.__key())
Expand Down

0 comments on commit c0d314a

Please sign in to comment.