mirror of
https://github.com/wting/autojump
synced 2025-12-05 14:12:00 +00:00
jumpapplet: load_path breaks without an earlier config file
When starting jumpapplet without an earlier config file, it raises an UnboundLocalError
tparker@shostakovich:[~/data/src/autojump] ./jumpapplet
loading settings
no config file
Traceback (most recent call last):
File "./jumpapplet", line 93, in popup
paths=load_paths(maxpath=defaults["maxpath"])
File "./jumpapplet", line 54, in load_paths
path_dict=path_dict.items()
UnboundLocalError: local variable 'path_dict' referenced before assignment
This patch fixes that
Signed-off-by: Pierre Gueth <georges.wbushjr@laposte.net>
This commit is contained in:
parent
278ea9cc01
commit
337e16391c
@ -64,13 +64,12 @@ def load_paths(filename="~/.autojump_py",maxpath=10):
|
|||||||
aj_file=open(dic_file)
|
aj_file=open(dic_file)
|
||||||
path_dict=cPickle.load(aj_file)
|
path_dict=cPickle.load(aj_file)
|
||||||
aj_file.close()
|
aj_file.close()
|
||||||
except IOError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
path_dict=path_dict.items()
|
path_dict=path_dict.items()
|
||||||
path_dict.sort(key=lambda x: x[1],reverse=True)
|
path_dict.sort(key=lambda x: x[1],reverse=True)
|
||||||
|
|
||||||
return [path for path,score in path_dict[:maxpath]]
|
return [path for path,score in path_dict[:maxpath]]
|
||||||
|
except IOError:
|
||||||
|
return []
|
||||||
|
|
||||||
def load_settings_file(filename="~/.jumpapplet_py"):
|
def load_settings_file(filename="~/.jumpapplet_py"):
|
||||||
print "loading settings"
|
print "loading settings"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user