1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +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:
Tom Parker 2009-04-29 19:04:22 +08:00 committed by Pierre Gueth
parent 278ea9cc01
commit 337e16391c

View File

@ -64,13 +64,12 @@ def load_paths(filename="~/.autojump_py",maxpath=10):
aj_file=open(dic_file)
path_dict=cPickle.load(aj_file)
aj_file.close()
except IOError:
pass
path_dict=path_dict.items()
path_dict.sort(key=lambda x: x[1],reverse=True)
return [path for path,score in path_dict[:maxpath]]
except IOError:
return []
def load_settings_file(filename="~/.jumpapplet_py"):
print "loading settings"