From 19927146dd611bd5163059d018ba907d786d9866 Mon Sep 17 00:00:00 2001 From: Joel Schaerer Date: Sun, 24 Oct 2010 11:42:45 +0200 Subject: [PATCH] 2.x compatibility --- autojump | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/autojump b/autojump index 55abdaa..802e561 100755 --- a/autojump +++ b/autojump @@ -23,7 +23,7 @@ except ImportError: import pickle import getopt -from sys import argv,exit,stderr +from sys import argv,exit,stderr,version_info from tempfile import NamedTemporaryFile import os import signal @@ -112,8 +112,11 @@ def find_matches(dirs,patterns,result_list,ignore_case,max_matches): def open_dic(dic_file,error_recovery=False): try: aj_file=open(dic_file, 'rb') - #encoding is only specified for python2.x compatibility - path_dict=pickle.load(aj_file,encoding="utf-8") + if version_info.major>2: + #encoding is only specified for python2.x compatibility + path_dict=pickle.load(aj_file,encoding="utf-8") + else: + path_dict=pickle.load(aj_file) aj_file.close() return path_dict except (IOError,EOFError,pickle.UnpicklingError):