Skip to content

Commit

Permalink
Clarify why we might not be able to open the database.
Browse files Browse the repository at this point in the history
Change load to not have mutable default values
  • Loading branch information
anothermindbomb committed Aug 19, 2014
1 parent 66283db commit f8d6a37
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def getDestinations(self, maxJumps=None, maxLy=None, maxLyPer=None, avoiding=Non
openList, closedList, destStations = Queue(), [sys for sys in avoiding if isinstance(sys, System)] + [self], []
openList.put([self.system, [], 0])
# Sys is always available, so we don't need to import it. maxint was deprecated in favour of maxsize.
# noinspection PyUnresolvedReferences
maxJumpDist = float(maxLyPer or sys.maxsize)
while not openList.empty():
(sys, jumps, dist) = openList.get()
Expand Down Expand Up @@ -161,12 +162,15 @@ def __init__(self, path=r'.\TradeDangerous.accdb', debug=0):
try:
self.conn = pypyodbc.connect(self.path)
except pypyodbc.Error as e:
print("Do you have the requisite driver installed? See http://www.microsoft.com/en-us/download/details.aspx?id=13255")
print("Do you have the requisite Access driver installed? See http://www.microsoft.com/en-us/download/details.aspx?id=13255")
raise e
self.load()

def load(self, avoidItems=[], avoidSystems=[], avoidStations=[], ignoreLinks=False):
def load(self, avoidItems=None, avoidSystems=None, avoidStations=None):
""" Populate/re-populate this instance with data from the TradeDB layer. """
if not avoidStations: avoidStations = []
if not avoidSystems: avoidSystems = []
if not avoidItems: avoidItems = []

# Create a cursor.
cur = self.conn.cursor()
Expand Down

0 comments on commit f8d6a37

Please sign in to comment.