prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  LookupError: unknown encoding on Mac with Python 2
  With latest `ycmd` I get the following error on Mac with Py2:
  
  ``` python
  Traceback (most recent call last):
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
      "__main__", fname, loader, pkg_name)
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
      exec code in run_globals
    File "/Users/peter/src/ycmd/ycmd/__main__.py", line 181, in <module>
      Main()
    File "/Users/peter/src/ycmd/ycmd/__main__.py", line 151, in Main
      options, hmac_secret = SetupOptions( args.options_file )
    File "/Users/peter/src/ycmd/ycmd/__main__.py", line 127, in SetupOptions
      options = user_options_store.DefaultOptions()
    File "/Users/peter/src/ycmd/ycmd/../ycmd/user_options_store.py", line 52, in DefaultOptions
      with open( settings_path ) as f:
  LookupError: unknown encoding: 
  
  Process ycmd-server exited abnormally with code 1
  ```
  
  I have a python 2 installation from homebrew
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ycmd/user_options_store.py`
  Content:
  ```
  1 # Copyright (C) 2013 Google Inc.
  2 #
  3 # This file is part of ycmd.
  4 #
  5 # ycmd is free software: you can redistribute it and/or modify
  6 # it under the terms of the GNU General Public License as published by
  7 # the Free Software Foundation, either version 3 of the License, or
  8 # (at your option) any later version.
  9 #
  10 # ycmd is distributed in the hope that it will be useful,
  11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 # GNU General Public License for more details.
  14 #
  15 # You should have received a copy of the GNU General Public License
  16 # along with ycmd.  If not, see <http://www.gnu.org/licenses/>.
  17 
  18 from __future__ import unicode_literals
  19 from __future__ import print_function
  20 from __future__ import division
  21 from __future__ import absolute_import
  22 from future import standard_library
  23 standard_library.install_aliases()
  24 from builtins import *  # noqa
  25 
  26 import json
  27 import os
  28 from frozendict import frozendict
  29 
  30 _USER_OPTIONS = {}
  31 
  32 def SetAll( new_options ):
  33   global _USER_OPTIONS
  34   _USER_OPTIONS = frozendict( new_options )
  35 
  36 
  37 def GetAll():
  38   return _USER_OPTIONS
  39 
  40 
  41 def Value( key ):
  42   return _USER_OPTIONS[ key ]
  43 
  44 
  45 def LoadDefaults():
  46   SetAll( DefaultOptions() )
  47 
  48 
  49 def DefaultOptions():
  50   settings_path = os.path.join(
  51       os.path.dirname( os.path.abspath( __file__ ) ), 'default_settings.json' )
  52   with open( settings_path ) as f:
  53     options = json.loads( f.read() )
  54     options.pop( 'hmac_secret', None )
  55     return options
  56 
  57
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/ycmd/user_options_store.py b/ycmd/user_options_store.py
  --- a/ycmd/user_options_store.py
  +++ b/ycmd/user_options_store.py
  @@ -27,8 +27,11 @@
   import os
   from frozendict import frozendict
   
  +from ycmd.utils import ReadFile
  +
   _USER_OPTIONS = {}
   
  +
   def SetAll( new_options ):
     global _USER_OPTIONS
     _USER_OPTIONS = frozendict( new_options )
  @@ -49,8 +52,6 @@
   def DefaultOptions():
     settings_path = os.path.join(
         os.path.dirname( os.path.abspath( __file__ ) ), 'default_settings.json' )
  -  with open( settings_path ) as f:
  -    options = json.loads( f.read() )
  -    options.pop( 'hmac_secret', None )
  -    return options
  -
  +  options = json.loads( ReadFile( settings_path ) )
  +  options.pop( 'hmac_secret', None )
  +  return options
  
verification_info: {"golden_diff": "diff --git a/ycmd/user_options_store.py b/ycmd/user_options_store.py\n--- a/ycmd/user_options_store.py\n+++ b/ycmd/user_options_store.py\n@@ -27,8 +27,11 @@\n import os\n from frozendict import frozendict\n \n+from ycmd.utils import ReadFile\n+\n _USER_OPTIONS = {}\n \n+\n def SetAll( new_options ):\n   global _USER_OPTIONS\n   _USER_OPTIONS = frozendict( new_options )\n@@ -49,8 +52,6 @@\n def DefaultOptions():\n   settings_path = os.path.join(\n       os.path.dirname( os.path.abspath( __file__ ) ), 'default_settings.json' )\n-  with open( settings_path ) as f:\n-    options = json.loads( f.read() )\n-    options.pop( 'hmac_secret', None )\n-    return options\n-\n+  options = json.loads( ReadFile( settings_path ) )\n+  options.pop( 'hmac_secret', None )\n+  return options\n", "issue": "LookupError: unknown encoding on Mac with Python 2\nWith latest `ycmd` I get the following error on Mac with Py2:\n\n``` python\nTraceback (most recent call last):\n  File \"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py\", line 162, in _run_module_as_main\n    \"__main__\", fname, loader, pkg_name)\n  File \"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/Users/peter/src/ycmd/ycmd/__main__.py\", line 181, in <module>\n    Main()\n  File \"/Users/peter/src/ycmd/ycmd/__main__.py\", line 151, in Main\n    options, hmac_secret = SetupOptions( args.options_file )\n  File \"/Users/peter/src/ycmd/ycmd/__main__.py\", line 127, in SetupOptions\n    options = user_options_store.DefaultOptions()\n  File \"/Users/peter/src/ycmd/ycmd/../ycmd/user_options_store.py\", line 52, in DefaultOptions\n    with open( settings_path ) as f:\nLookupError: unknown encoding: \n\nProcess ycmd-server exited abnormally with code 1\n```\n\nI have a python 2 installation from homebrew\n\n", "before_files": [{"content": "# Copyright (C) 2013 Google Inc.\n#\n# This file is part of ycmd.\n#\n# ycmd is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# ycmd is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with ycmd.  If not, see <http://www.gnu.org/licenses/>.\n\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom future import standard_library\nstandard_library.install_aliases()\nfrom builtins import *  # noqa\n\nimport json\nimport os\nfrom frozendict import frozendict\n\n_USER_OPTIONS = {}\n\ndef SetAll( new_options ):\n  global _USER_OPTIONS\n  _USER_OPTIONS = frozendict( new_options )\n\n\ndef GetAll():\n  return _USER_OPTIONS\n\n\ndef Value( key ):\n  return _USER_OPTIONS[ key ]\n\n\ndef LoadDefaults():\n  SetAll( DefaultOptions() )\n\n\ndef DefaultOptions():\n  settings_path = os.path.join(\n      os.path.dirname( os.path.abspath( __file__ ) ), 'default_settings.json' )\n  with open( settings_path ) as f:\n    options = json.loads( f.read() )\n    options.pop( 'hmac_secret', None )\n    return options\n\n", "path": "ycmd/user_options_store.py"}], "after_files": [{"content": "# Copyright (C) 2013 Google Inc.\n#\n# This file is part of ycmd.\n#\n# ycmd is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# ycmd is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with ycmd.  If not, see <http://www.gnu.org/licenses/>.\n\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom future import standard_library\nstandard_library.install_aliases()\nfrom builtins import *  # noqa\n\nimport json\nimport os\nfrom frozendict import frozendict\n\nfrom ycmd.utils import ReadFile\n\n_USER_OPTIONS = {}\n\n\ndef SetAll( new_options ):\n  global _USER_OPTIONS\n  _USER_OPTIONS = frozendict( new_options )\n\n\ndef GetAll():\n  return _USER_OPTIONS\n\n\ndef Value( key ):\n  return _USER_OPTIONS[ key ]\n\n\ndef LoadDefaults():\n  SetAll( DefaultOptions() )\n\n\ndef DefaultOptions():\n  settings_path = os.path.join(\n      os.path.dirname( os.path.abspath( __file__ ) ), 'default_settings.json' )\n  options = json.loads( ReadFile( settings_path ) )\n  options.pop( 'hmac_secret', None )\n  return options\n", "path": "ycmd/user_options_store.py"}]}