We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
pyramid.exceptions.ConfigurationConflictError: <exception str() failed>
**Describe the bug**
While building an app I caused an error who's traceback ending the the following line:
```
pyramid.exceptions.ConfigurationConflictError: <exception str() failed>
```
What caused the error in the first place was that I copied a python package containing my views to a new package called controllers and forgot to delete the original views package. I assume that the configurator failed while trying to commit the config.scan(). Since I couldn't find any information online about the above traceback message I assume that this is probably just some internal problem with Pyramid. 
**To Reproduce**
download from: https://github.com/benkawecki/pypi/tree/error
after setting up run 
``` 
pserve development.ini
```

**Expected behavior**
I expect there to be an error message. 

**Screenshots**
Screenshot of the error message:
<img width="489" alt="screen shot 2019-01-15 at 10 02 44 pm" src="https://user-images.githubusercontent.com/39999125/51224413-c57eb800-1913-11e9-9e0f-b25878a479f5.png">
Screenshot of installed packages:
<img width="488" alt="screen shot 2019-01-15 at 10 24 42 pm" src="https://user-images.githubusercontent.com/39999125/51224563-8b61e600-1914-11e9-9b04-42936f94d4bd.png">



**Additional context**
I'm looking to help out in open-source more this year so if this is an easy fix I would love to see if I can do it!


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/pyramid/exceptions.py`
Content:
```
1 from pyramid.httpexceptions import HTTPBadRequest, HTTPNotFound, HTTPForbidden
2 
3 NotFound = HTTPNotFound  # bw compat
4 Forbidden = HTTPForbidden  # bw compat
5 
6 CR = '\n'
7 
8 
9 class BadCSRFOrigin(HTTPBadRequest):
10     """
11     This exception indicates the request has failed cross-site request forgery
12     origin validation.
13     """
14 
15     title = "Bad CSRF Origin"
16     explanation = (
17         "Access is denied. This server can not verify that the origin or "
18         "referrer of your request matches the current site. Either your "
19         "browser supplied the wrong Origin or Referrer or it did not supply "
20         "one at all."
21     )
22 
23 
24 class BadCSRFToken(HTTPBadRequest):
25     """
26     This exception indicates the request has failed cross-site request
27     forgery token validation.
28     """
29 
30     title = 'Bad CSRF Token'
31     explanation = (
32         'Access is denied.  This server can not verify that your cross-site '
33         'request forgery token belongs to your login session.  Either you '
34         'supplied the wrong cross-site request forgery token or your session '
35         'no longer exists.  This may be due to session timeout or because '
36         'browser is not supplying the credentials required, as can happen '
37         'when the browser has cookies turned off.'
38     )
39 
40 
41 class PredicateMismatch(HTTPNotFound):
42     """
43     This exception is raised by multiviews when no view matches
44     all given predicates.
45 
46     This exception subclasses the :class:`HTTPNotFound` exception for a
47     specific reason: if it reaches the main exception handler, it should
48     be treated as :class:`HTTPNotFound`` by any exception view
49     registrations. Thus, typically, this exception will not be seen
50     publicly.
51 
52     However, this exception will be raised if the predicates of all
53     views configured to handle another exception context cannot be
54     successfully matched.  For instance, if a view is configured to
55     handle a context of ``HTTPForbidden`` and the configured with
56     additional predicates, then :class:`PredicateMismatch` will be
57     raised if:
58 
59     * An original view callable has raised :class:`HTTPForbidden` (thus
60       invoking an exception view); and
61     * The given request fails to match all predicates for said
62       exception view associated with :class:`HTTPForbidden`.
63 
64     The same applies to any type of exception being handled by an
65     exception view.
66     """
67 
68 
69 class URLDecodeError(UnicodeDecodeError):
70     """
71     This exception is raised when :app:`Pyramid` cannot
72     successfully decode a URL or a URL path segment.  This exception
73     behaves just like the Python builtin
74     :exc:`UnicodeDecodeError`. It is a subclass of the builtin
75     :exc:`UnicodeDecodeError` exception only for identity purposes,
76     mostly so an exception view can be registered when a URL cannot be
77     decoded.
78     """
79 
80 
81 class ConfigurationError(Exception):
82     """ Raised when inappropriate input values are supplied to an API
83     method of a :term:`Configurator`"""
84 
85 
86 class ConfigurationConflictError(ConfigurationError):
87     """ Raised when a configuration conflict is detected during action
88     processing"""
89 
90     def __init__(self, conflicts):
91         self._conflicts = conflicts
92 
93     def __str__(self):
94         r = ["Conflicting configuration actions"]
95         items = sorted(self._conflicts.items())
96         for discriminator, infos in items:
97             r.append("  For: %s" % (discriminator,))
98             for info in infos:
99                 for line in str(info).rstrip().split(CR):
100                     r.append("    " + line)
101 
102         return CR.join(r)
103 
104 
105 class ConfigurationExecutionError(ConfigurationError):
106     """An error occurred during execution of a configuration action
107     """
108 
109     def __init__(self, etype, evalue, info):
110         self.etype, self.evalue, self.info = etype, evalue, info
111 
112     def __str__(self):
113         return "%s: %s\n  in:\n  %s" % (self.etype, self.evalue, self.info)
114 
115 
116 class CyclicDependencyError(Exception):
117     """ The exception raised when the Pyramid topological sorter detects a
118     cyclic dependency."""
119 
120     def __init__(self, cycles):
121         self.cycles = cycles
122 
123     def __str__(self):
124         L = []
125         cycles = self.cycles
126         for cycle in cycles:
127             dependent = cycle
128             dependees = cycles[cycle]
129             L.append('%r sorts before %r' % (dependent, dependees))
130         msg = 'Implicit ordering cycle:' + '; '.join(L)
131         return msg
132
```
--- 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()

```

diff --git a/src/pyramid/exceptions.py b/src/pyramid/exceptions.py
--- a/src/pyramid/exceptions.py
+++ b/src/pyramid/exceptions.py
@@ -3,8 +3,6 @@
 NotFound = HTTPNotFound  # bw compat
 Forbidden = HTTPForbidden  # bw compat
 
-CR = '\n'
-
 
 class BadCSRFOrigin(HTTPBadRequest):
     """
@@ -92,14 +90,13 @@
 
     def __str__(self):
         r = ["Conflicting configuration actions"]
-        items = sorted(self._conflicts.items())
-        for discriminator, infos in items:
+        for discriminator, infos in self._conflicts.items():
             r.append("  For: %s" % (discriminator,))
             for info in infos:
-                for line in str(info).rstrip().split(CR):
+                for line in str(info).rstrip().split('\n'):
                     r.append("    " + line)
 
-        return CR.join(r)
+        return '\n'.join(r)
 
 
 class ConfigurationExecutionError(ConfigurationError):

{"golden_diff": "diff --git a/src/pyramid/exceptions.py b/src/pyramid/exceptions.py\n--- a/src/pyramid/exceptions.py\n+++ b/src/pyramid/exceptions.py\n@@ -3,8 +3,6 @@\n NotFound = HTTPNotFound  # bw compat\n Forbidden = HTTPForbidden  # bw compat\n \n-CR = '\\n'\n-\n \n class BadCSRFOrigin(HTTPBadRequest):\n     \"\"\"\n@@ -92,14 +90,13 @@\n \n     def __str__(self):\n         r = [\"Conflicting configuration actions\"]\n-        items = sorted(self._conflicts.items())\n-        for discriminator, infos in items:\n+        for discriminator, infos in self._conflicts.items():\n             r.append(\"  For: %s\" % (discriminator,))\n             for info in infos:\n-                for line in str(info).rstrip().split(CR):\n+                for line in str(info).rstrip().split('\\n'):\n                     r.append(\"    \" + line)\n \n-        return CR.join(r)\n+        return '\\n'.join(r)\n \n \n class ConfigurationExecutionError(ConfigurationError):\n", "issue": "pyramid.exceptions.ConfigurationConflictError: <exception str() failed>\n**Describe the bug**\r\nWhile building an app I caused an error who's traceback ending the the following line:\r\n```\r\npyramid.exceptions.ConfigurationConflictError: <exception str() failed>\r\n```\r\nWhat caused the error in the first place was that I copied a python package containing my views to a new package called controllers and forgot to delete the original views package. I assume that the configurator failed while trying to commit the config.scan(). Since I couldn't find any information online about the above traceback message I assume that this is probably just some internal problem with Pyramid. \r\n**To Reproduce**\r\ndownload from: https://github.com/benkawecki/pypi/tree/error\r\nafter setting up run \r\n``` \r\npserve development.ini\r\n```\r\n\r\n**Expected behavior**\r\nI expect there to be an error message. \r\n\r\n**Screenshots**\r\nScreenshot of the error message:\r\n<img width=\"489\" alt=\"screen shot 2019-01-15 at 10 02 44 pm\" src=\"https://user-images.githubusercontent.com/39999125/51224413-c57eb800-1913-11e9-9e0f-b25878a479f5.png\">\r\nScreenshot of installed packages:\r\n<img width=\"488\" alt=\"screen shot 2019-01-15 at 10 24 42 pm\" src=\"https://user-images.githubusercontent.com/39999125/51224563-8b61e600-1914-11e9-9b04-42936f94d4bd.png\">\r\n\r\n\r\n\r\n**Additional context**\r\nI'm looking to help out in open-source more this year so if this is an easy fix I would love to see if I can do it!\r\n\n", "before_files": [{"content": "from pyramid.httpexceptions import HTTPBadRequest, HTTPNotFound, HTTPForbidden\n\nNotFound = HTTPNotFound  # bw compat\nForbidden = HTTPForbidden  # bw compat\n\nCR = '\\n'\n\n\nclass BadCSRFOrigin(HTTPBadRequest):\n    \"\"\"\n    This exception indicates the request has failed cross-site request forgery\n    origin validation.\n    \"\"\"\n\n    title = \"Bad CSRF Origin\"\n    explanation = (\n        \"Access is denied. This server can not verify that the origin or \"\n        \"referrer of your request matches the current site. Either your \"\n        \"browser supplied the wrong Origin or Referrer or it did not supply \"\n        \"one at all.\"\n    )\n\n\nclass BadCSRFToken(HTTPBadRequest):\n    \"\"\"\n    This exception indicates the request has failed cross-site request\n    forgery token validation.\n    \"\"\"\n\n    title = 'Bad CSRF Token'\n    explanation = (\n        'Access is denied.  This server can not verify that your cross-site '\n        'request forgery token belongs to your login session.  Either you '\n        'supplied the wrong cross-site request forgery token or your session '\n        'no longer exists.  This may be due to session timeout or because '\n        'browser is not supplying the credentials required, as can happen '\n        'when the browser has cookies turned off.'\n    )\n\n\nclass PredicateMismatch(HTTPNotFound):\n    \"\"\"\n    This exception is raised by multiviews when no view matches\n    all given predicates.\n\n    This exception subclasses the :class:`HTTPNotFound` exception for a\n    specific reason: if it reaches the main exception handler, it should\n    be treated as :class:`HTTPNotFound`` by any exception view\n    registrations. Thus, typically, this exception will not be seen\n    publicly.\n\n    However, this exception will be raised if the predicates of all\n    views configured to handle another exception context cannot be\n    successfully matched.  For instance, if a view is configured to\n    handle a context of ``HTTPForbidden`` and the configured with\n    additional predicates, then :class:`PredicateMismatch` will be\n    raised if:\n\n    * An original view callable has raised :class:`HTTPForbidden` (thus\n      invoking an exception view); and\n    * The given request fails to match all predicates for said\n      exception view associated with :class:`HTTPForbidden`.\n\n    The same applies to any type of exception being handled by an\n    exception view.\n    \"\"\"\n\n\nclass URLDecodeError(UnicodeDecodeError):\n    \"\"\"\n    This exception is raised when :app:`Pyramid` cannot\n    successfully decode a URL or a URL path segment.  This exception\n    behaves just like the Python builtin\n    :exc:`UnicodeDecodeError`. It is a subclass of the builtin\n    :exc:`UnicodeDecodeError` exception only for identity purposes,\n    mostly so an exception view can be registered when a URL cannot be\n    decoded.\n    \"\"\"\n\n\nclass ConfigurationError(Exception):\n    \"\"\" Raised when inappropriate input values are supplied to an API\n    method of a :term:`Configurator`\"\"\"\n\n\nclass ConfigurationConflictError(ConfigurationError):\n    \"\"\" Raised when a configuration conflict is detected during action\n    processing\"\"\"\n\n    def __init__(self, conflicts):\n        self._conflicts = conflicts\n\n    def __str__(self):\n        r = [\"Conflicting configuration actions\"]\n        items = sorted(self._conflicts.items())\n        for discriminator, infos in items:\n            r.append(\"  For: %s\" % (discriminator,))\n            for info in infos:\n                for line in str(info).rstrip().split(CR):\n                    r.append(\"    \" + line)\n\n        return CR.join(r)\n\n\nclass ConfigurationExecutionError(ConfigurationError):\n    \"\"\"An error occurred during execution of a configuration action\n    \"\"\"\n\n    def __init__(self, etype, evalue, info):\n        self.etype, self.evalue, self.info = etype, evalue, info\n\n    def __str__(self):\n        return \"%s: %s\\n  in:\\n  %s\" % (self.etype, self.evalue, self.info)\n\n\nclass CyclicDependencyError(Exception):\n    \"\"\" The exception raised when the Pyramid topological sorter detects a\n    cyclic dependency.\"\"\"\n\n    def __init__(self, cycles):\n        self.cycles = cycles\n\n    def __str__(self):\n        L = []\n        cycles = self.cycles\n        for cycle in cycles:\n            dependent = cycle\n            dependees = cycles[cycle]\n            L.append('%r sorts before %r' % (dependent, dependees))\n        msg = 'Implicit ordering cycle:' + '; '.join(L)\n        return msg\n", "path": "src/pyramid/exceptions.py"}], "after_files": [{"content": "from pyramid.httpexceptions import HTTPBadRequest, HTTPNotFound, HTTPForbidden\n\nNotFound = HTTPNotFound  # bw compat\nForbidden = HTTPForbidden  # bw compat\n\n\nclass BadCSRFOrigin(HTTPBadRequest):\n    \"\"\"\n    This exception indicates the request has failed cross-site request forgery\n    origin validation.\n    \"\"\"\n\n    title = \"Bad CSRF Origin\"\n    explanation = (\n        \"Access is denied. This server can not verify that the origin or \"\n        \"referrer of your request matches the current site. Either your \"\n        \"browser supplied the wrong Origin or Referrer or it did not supply \"\n        \"one at all.\"\n    )\n\n\nclass BadCSRFToken(HTTPBadRequest):\n    \"\"\"\n    This exception indicates the request has failed cross-site request\n    forgery token validation.\n    \"\"\"\n\n    title = 'Bad CSRF Token'\n    explanation = (\n        'Access is denied.  This server can not verify that your cross-site '\n        'request forgery token belongs to your login session.  Either you '\n        'supplied the wrong cross-site request forgery token or your session '\n        'no longer exists.  This may be due to session timeout or because '\n        'browser is not supplying the credentials required, as can happen '\n        'when the browser has cookies turned off.'\n    )\n\n\nclass PredicateMismatch(HTTPNotFound):\n    \"\"\"\n    This exception is raised by multiviews when no view matches\n    all given predicates.\n\n    This exception subclasses the :class:`HTTPNotFound` exception for a\n    specific reason: if it reaches the main exception handler, it should\n    be treated as :class:`HTTPNotFound`` by any exception view\n    registrations. Thus, typically, this exception will not be seen\n    publicly.\n\n    However, this exception will be raised if the predicates of all\n    views configured to handle another exception context cannot be\n    successfully matched.  For instance, if a view is configured to\n    handle a context of ``HTTPForbidden`` and the configured with\n    additional predicates, then :class:`PredicateMismatch` will be\n    raised if:\n\n    * An original view callable has raised :class:`HTTPForbidden` (thus\n      invoking an exception view); and\n    * The given request fails to match all predicates for said\n      exception view associated with :class:`HTTPForbidden`.\n\n    The same applies to any type of exception being handled by an\n    exception view.\n    \"\"\"\n\n\nclass URLDecodeError(UnicodeDecodeError):\n    \"\"\"\n    This exception is raised when :app:`Pyramid` cannot\n    successfully decode a URL or a URL path segment.  This exception\n    behaves just like the Python builtin\n    :exc:`UnicodeDecodeError`. It is a subclass of the builtin\n    :exc:`UnicodeDecodeError` exception only for identity purposes,\n    mostly so an exception view can be registered when a URL cannot be\n    decoded.\n    \"\"\"\n\n\nclass ConfigurationError(Exception):\n    \"\"\" Raised when inappropriate input values are supplied to an API\n    method of a :term:`Configurator`\"\"\"\n\n\nclass ConfigurationConflictError(ConfigurationError):\n    \"\"\" Raised when a configuration conflict is detected during action\n    processing\"\"\"\n\n    def __init__(self, conflicts):\n        self._conflicts = conflicts\n\n    def __str__(self):\n        r = [\"Conflicting configuration actions\"]\n        for discriminator, infos in self._conflicts.items():\n            r.append(\"  For: %s\" % (discriminator,))\n            for info in infos:\n                for line in str(info).rstrip().split('\\n'):\n                    r.append(\"    \" + line)\n\n        return '\\n'.join(r)\n\n\nclass ConfigurationExecutionError(ConfigurationError):\n    \"\"\"An error occurred during execution of a configuration action\n    \"\"\"\n\n    def __init__(self, etype, evalue, info):\n        self.etype, self.evalue, self.info = etype, evalue, info\n\n    def __str__(self):\n        return \"%s: %s\\n  in:\\n  %s\" % (self.etype, self.evalue, self.info)\n\n\nclass CyclicDependencyError(Exception):\n    \"\"\" The exception raised when the Pyramid topological sorter detects a\n    cyclic dependency.\"\"\"\n\n    def __init__(self, cycles):\n        self.cycles = cycles\n\n    def __str__(self):\n        L = []\n        cycles = self.cycles\n        for cycle in cycles:\n            dependent = cycle\n            dependees = cycles[cycle]\n            L.append('%r sorts before %r' % (dependent, dependees))\n        msg = 'Implicit ordering cycle:' + '; '.join(L)\n        return msg\n", "path": "src/pyramid/exceptions.py"}]}