From 123c5c4acb6f3b1e80b76d3b57ca91973f2ed7ad Mon Sep 17 00:00:00 2001 From: Val Markovic Date: Sun, 28 Feb 2016 14:41:09 -0800 Subject: [PATCH] Fixing ycmd startup under py3 Some syntax rules are different for py3 plus the standard bytes vs unicode nonsense. --- python/ycm/youcompleteme.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index dab6ed67..39a86fe0 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -104,17 +104,18 @@ class YouCompleteMe( object ): self._SetupServer() self._ycmd_keepalive.Start() self._complete_done_hooks = { - 'cs': lambda( self ): self._OnCompleteDone_Csharp() + 'cs': lambda self: self._OnCompleteDone_Csharp() } def _SetupServer( self ): self._available_completers = {} server_port = utils.GetUnusedLocalhostPort() # The temp options file is deleted by ycmd during startup - with tempfile.NamedTemporaryFile( delete = False ) as options_file: + with tempfile.NamedTemporaryFile( delete = False, mode = 'w+' ) as options_file: hmac_secret = os.urandom( HMAC_SECRET_LENGTH ) options_dict = dict( self._user_options ) - options_dict[ 'hmac_secret' ] = base64.b64encode( hmac_secret ) + options_dict[ 'hmac_secret' ] = utils.ToUnicode( + base64.b64encode( hmac_secret ) ) json.dump( options_dict, options_file ) options_file.flush()