From 90ab26d50b8db176dcf1d8b09cfe9a16b376f033 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 24 Mar 2015 23:17:24 +0100 Subject: [PATCH] fix regressions in alfred.py --- lib/alfred.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/alfred.py b/lib/alfred.py index 1b9b220..4353874 100644 --- a/lib/alfred.py +++ b/lib/alfred.py @@ -8,17 +8,15 @@ class Alfred(object): Bindings for the alfred-json utility """ def __init__(self, unix_sockpath=None): - if unix_sockpath: - if os.path.exists(unix_sockpath): - self.unix_sock = unix_sockpath - else: - raise RuntimeError('alfred: invalid unix socket path given') + self.unix_sock = unix_sockpath + if unix_sockpath is not None and not os.path.exists(unix_sockpath): + raise RuntimeError('alfred: invalid unix socket path given') def _fetch(self, data_type): cmd = ['alfred-json', '-z', '-f', 'json', - '-r', data_type] + '-r', str(data_type)] if self.unix_sock: cmd.extend(['-s', self.unix_sock])