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>
pull/18/head
Tom Parker 15 years ago committed by Pierre Gueth
parent 278ea9cc01
commit 337e16391c

@ -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)
path_dict=path_dict.items()
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"):
print "loading settings"

Loading…
Cancel
Save