Skip to content

Commit

Permalink
Merge pull request schodet#145 from dlech/cfg-file-fix
Browse files Browse the repository at this point in the history
fix crash when no config file
  • Loading branch information
GoldSloth authored Apr 30, 2018
2 parents e88d7d8 + a111be0 commit 17a5a29
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions nxt/locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ def find_one_brick(host=None, name=None, silent=False, strict=None, debug=False,
host = conf.get('Brick', 'host')
name = conf.get('Brick', 'name')
strict = bool(int(conf.get('Brick', 'strict')))
methods = map(lambda x: x.strip().split('='),
conf.get('Brick', 'method').split(','))
method = Method(**{k: v == 'True' for k, v in methods
if k in ('bluetooth', 'usb', 'device')})
method_value = conf.get('Brick', 'method')
if method_value:
methods = map(lambda x: x.strip().split('='),
method_value.split(','))
method = Method(**{k: v == 'True' for k, v in methods
if k in ('bluetooth', 'usb', 'device')})
if not strict: strict = True
if not method: method = Method()

Expand Down

0 comments on commit 17a5a29

Please sign in to comment.