From f671fe72b29a6afbfd8ac0b7c816dd440b9818c3 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Thu, 31 Jan 2013 17:32:39 -0800 Subject: [PATCH] Adding our paths to sys.path start, not end Otherwise things can conflict and we could end up loading the wrong module. --- python/completers/cpp/flags.py | 4 ++-- python/ycm.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/completers/cpp/flags.py b/python/completers/cpp/flags.py index 9dc857c6..16b4c75d 100644 --- a/python/completers/cpp/flags.py +++ b/python/completers/cpp/flags.py @@ -75,9 +75,9 @@ class Flags( object ): flags_module = self.flags_module_for_flags_module_file[ flags_module_file ] except KeyError: - sys.path.append( _DirectoryOfThisScript() ) + sys.path.insert( 0, _DirectoryOfThisScript() ) flags_module = imp.load_source( _RandomName(), flags_module_file ) - del sys.path[ -1 ] + del sys.path[ 0 ] self.flags_module_for_flags_module_file[ flags_module_file ] = flags_module diff --git a/python/ycm.py b/python/ycm.py index a787fa51..c29494a7 100644 --- a/python/ycm.py +++ b/python/ycm.py @@ -73,9 +73,9 @@ class YouCompleteMe( object ): supported_filetypes = [ filetype ] if os.path.exists( module_path ): - sys.path.append( os.path.dirname( module_path ) ) + sys.path.insert( 0, os.path.dirname( module_path ) ) module = imp.load_source( filetype, module_path ) - del sys.path[ -1 ] + del sys.path[ 0 ] completer = module.GetCompleter() if completer: