prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Updated Error on Version File Missing
  4XX errors are client errors. In that case, if the file is not on the server, the client is not guilty
  Raise error instead of returning 404 on __version__ if version file is missing
  https://github.com/Kinto/kinto/blame/master/kinto/core/views/version.py#L49
  
  suggested by @peterbe 
  
  4XX errors are client errors. In that case, if the file is not on the server, the client is not guilty ;)
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kinto/core/views/version.py`
  Content:
  ```
  1 import json
  2 import os
  3 
  4 import colander
  5 from pyramid import httpexceptions
  6 from pyramid.security import NO_PERMISSION_REQUIRED
  7 from kinto.core import Service
  8 
  9 HERE = os.path.dirname(__file__)
  10 ORIGIN = os.path.dirname(HERE)
  11 
  12 
  13 class VersionResponseSchema(colander.MappingSchema):
  14     body = colander.SchemaNode(colander.Mapping(unknown="preserve"))
  15 
  16 
  17 version_response_schemas = {
  18     "200": VersionResponseSchema(description="Return the running Instance version information.")
  19 }
  20 
  21 
  22 version = Service(name="version", path="/__version__", description="Version")
  23 
  24 
  25 @version.get(
  26     permission=NO_PERMISSION_REQUIRED,
  27     tags=["Utilities"],
  28     operation_id="__version__",
  29     response_schemas=version_response_schemas,
  30 )
  31 def version_view(request):
  32     try:
  33         return version_view.__json__
  34     except AttributeError:
  35         pass
  36 
  37     location = request.registry.settings["version_json_path"]
  38     files = [
  39         location,  # Default is current working dir.
  40         os.path.join(ORIGIN, "version.json"),  # Relative to the package root.
  41         os.path.join(HERE, "version.json"),  # Relative to this file.
  42     ]
  43     for version_file in files:
  44         if os.path.exists(version_file):
  45             with open(version_file) as f:
  46                 version_view.__json__ = json.load(f)
  47                 return version_view.__json__  # First one wins.
  48 
  49     raise httpexceptions.HTTPNotFound()
  50
  ```
  --- 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/kinto/core/views/version.py b/kinto/core/views/version.py
  --- a/kinto/core/views/version.py
  +++ b/kinto/core/views/version.py
  @@ -2,7 +2,6 @@
   import os
   
   import colander
  -from pyramid import httpexceptions
   from pyramid.security import NO_PERMISSION_REQUIRED
   from kinto.core import Service
   
  @@ -46,4 +45,4 @@
                   version_view.__json__ = json.load(f)
                   return version_view.__json__  # First one wins.
   
  -    raise httpexceptions.HTTPNotFound()
  +    raise FileNotFoundError("Version file missing from {}".format(files.join(",")))
  
verification_info: {"golden_diff": "diff --git a/kinto/core/views/version.py b/kinto/core/views/version.py\n--- a/kinto/core/views/version.py\n+++ b/kinto/core/views/version.py\n@@ -2,7 +2,6 @@\n import os\n \n import colander\n-from pyramid import httpexceptions\n from pyramid.security import NO_PERMISSION_REQUIRED\n from kinto.core import Service\n \n@@ -46,4 +45,4 @@\n                 version_view.__json__ = json.load(f)\n                 return version_view.__json__  # First one wins.\n \n-    raise httpexceptions.HTTPNotFound()\n+    raise FileNotFoundError(\"Version file missing from {}\".format(files.join(\",\")))\n", "issue": "Updated Error on Version File Missing\n4XX errors are client errors. In that case, if the file is not on the server, the client is not guilty\nRaise error instead of returning 404 on __version__ if version file is missing\nhttps://github.com/Kinto/kinto/blame/master/kinto/core/views/version.py#L49\r\n\r\nsuggested by @peterbe \r\n\r\n4XX errors are client errors. In that case, if the file is not on the server, the client is not guilty ;)\n", "before_files": [{"content": "import json\nimport os\n\nimport colander\nfrom pyramid import httpexceptions\nfrom pyramid.security import NO_PERMISSION_REQUIRED\nfrom kinto.core import Service\n\nHERE = os.path.dirname(__file__)\nORIGIN = os.path.dirname(HERE)\n\n\nclass VersionResponseSchema(colander.MappingSchema):\n    body = colander.SchemaNode(colander.Mapping(unknown=\"preserve\"))\n\n\nversion_response_schemas = {\n    \"200\": VersionResponseSchema(description=\"Return the running Instance version information.\")\n}\n\n\nversion = Service(name=\"version\", path=\"/__version__\", description=\"Version\")\n\n\n@version.get(\n    permission=NO_PERMISSION_REQUIRED,\n    tags=[\"Utilities\"],\n    operation_id=\"__version__\",\n    response_schemas=version_response_schemas,\n)\ndef version_view(request):\n    try:\n        return version_view.__json__\n    except AttributeError:\n        pass\n\n    location = request.registry.settings[\"version_json_path\"]\n    files = [\n        location,  # Default is current working dir.\n        os.path.join(ORIGIN, \"version.json\"),  # Relative to the package root.\n        os.path.join(HERE, \"version.json\"),  # Relative to this file.\n    ]\n    for version_file in files:\n        if os.path.exists(version_file):\n            with open(version_file) as f:\n                version_view.__json__ = json.load(f)\n                return version_view.__json__  # First one wins.\n\n    raise httpexceptions.HTTPNotFound()\n", "path": "kinto/core/views/version.py"}], "after_files": [{"content": "import json\nimport os\n\nimport colander\nfrom pyramid.security import NO_PERMISSION_REQUIRED\nfrom kinto.core import Service\n\nHERE = os.path.dirname(__file__)\nORIGIN = os.path.dirname(HERE)\n\n\nclass VersionResponseSchema(colander.MappingSchema):\n    body = colander.SchemaNode(colander.Mapping(unknown=\"preserve\"))\n\n\nversion_response_schemas = {\n    \"200\": VersionResponseSchema(description=\"Return the running Instance version information.\")\n}\n\n\nversion = Service(name=\"version\", path=\"/__version__\", description=\"Version\")\n\n\n@version.get(\n    permission=NO_PERMISSION_REQUIRED,\n    tags=[\"Utilities\"],\n    operation_id=\"__version__\",\n    response_schemas=version_response_schemas,\n)\ndef version_view(request):\n    try:\n        return version_view.__json__\n    except AttributeError:\n        pass\n\n    location = request.registry.settings[\"version_json_path\"]\n    files = [\n        location,  # Default is current working dir.\n        os.path.join(ORIGIN, \"version.json\"),  # Relative to the package root.\n        os.path.join(HERE, \"version.json\"),  # Relative to this file.\n    ]\n    for version_file in files:\n        if os.path.exists(version_file):\n            with open(version_file) as f:\n                version_view.__json__ = json.load(f)\n                return version_view.__json__  # First one wins.\n\n    raise FileNotFoundError(\"Version file missing from {}\".format(files.join(\",\")))\n", "path": "kinto/core/views/version.py"}]}