We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Demo noninteractive.py, Errors after <ENTER>
**Problem Description**
Errors after <ENTER>
**Reproduction Steps:**

Run noninteractive.py and hit ENTER

**Expected behavior:**
```
 Please enter a path in which to place generated plots.
Press <ENTER> to generate in the current directory.
Path:
Traceback (most recent call last):
  File "noninteractive.py", line 113, in <module>
    draw_plot(get_directory('noninteractive.png'), size=(800, 600))
  File "noninteractive.py", line 90, in get_directory
    path = input('Path: ').strip()
  File "<string>", line 0

    ^
SyntaxError: unexpected EOF while parsing
```
**OS, Python version:**
OSX, Python 2.7

xref: #385 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `examples/demo/noninteractive.py`
Content:
```
1 #!/usr/bin/env python
2 """
3 This demonstrates how to create a plot offscreen and save it to an image
4 file on disk.
5 """
6 from __future__ import print_function
7 
8 # Standard library imports
9 import os
10 import sys
11 
12 # Major library imports
13 from numpy import linspace
14 from scipy.special import jn
15 
16 # Enthought library imports
17 from traits.etsconfig.api import ETSConfig
18 
19 # Chaco imports
20 from chaco.api import ArrayPlotData, Plot, PlotGraphicsContext
21 from chaco.example_support import COLOR_PALETTE
22 
23 DPI = 72.0
24 
25 # This is a bit of a hack, to work around the fact that line widths don't scale
26 # with the GraphicsContext's CTM.
27 dpi_scale = DPI / 72.0
28 
29 
30 def create_plot():
31     numpoints = 100
32     low = -5
33     high = 15.0
34     x = linspace(low, high, numpoints)
35     pd = ArrayPlotData(index=x)
36     p = Plot(pd, bgcolor="oldlace", padding=50, border_visible=True)
37     for i in range(10):
38         pd.set_data("y" + str(i), jn(i, x))
39         p.plot(("index", "y" + str(i)), color=tuple(COLOR_PALETTE[i]),
40                width=2.0 * dpi_scale)
41     p.x_grid.visible = True
42     p.x_grid.line_width *= dpi_scale
43     p.y_grid.visible = True
44     p.y_grid.line_width *= dpi_scale
45     p.legend.visible = True
46     return p
47 
48 
49 def draw_plot(filename, size=(800, 600)):
50     container = create_plot()
51     container.outer_bounds = list(size)
52     container.do_layout(force=True)
53     gc = PlotGraphicsContext(size, dpi=DPI)
54     gc.render_component(container)
55     gc.save(filename)
56     return
57 
58 
59 def draw_svg(filename, size=(800, 600)):
60     from chaco.svg_graphics_context import SVGGraphicsContext
61     container = create_plot()
62     container.bounds = list(size)
63     container.do_layout(force=True)
64     gc = SVGGraphicsContext(size)
65     gc.render_component(container)
66     gc.save(filename)
67 
68 
69 def draw_pdf(filename, size=(800, 600)):
70     from chaco.pdf_graphics_context import PdfPlotGraphicsContext
71     container = create_plot()
72     container.outer_bounds = list(size)
73     container.do_layout(force=True)
74     gc = PdfPlotGraphicsContext(filename=filename,
75                                 dest_box=(0.5, 0.5, 5.0, 5.0))
76 
77     for i in range(2):
78         # draw the plot
79         gc.render_component(container)
80 
81         #Start a new page for subsequent draw commands.
82         gc.add_page()
83 
84     gc.save()
85 
86 
87 def get_directory(filename):
88     print('Please enter a path in which to place generated plots.')
89     print('Press <ENTER> to generate in the current directory.')
90     path = input('Path: ').strip()
91 
92     if len(path) > 0 and not os.path.exists(path):
93         print('The given path does not exist.')
94         sys.exit()
95 
96     if not os.path.isabs(path):
97         print('Creating image: ' + os.path.join(os.getcwd(), path, filename))
98 
99     else:
100         print('Creating image: ' + os.path.join(path, filename))
101 
102     return os.path.join(path, filename)
103 
104 
105 if __name__ == "__main__":
106     if ETSConfig.kiva_backend == 'svg':
107         # Render the plot as a SVG
108         draw_svg(get_directory('noninteractive.svg'), size=(800, 600))
109     elif ETSConfig.kiva_backend == 'pdf':
110         # Render the plot as a PDF, requires on ReportLab
111         draw_pdf(get_directory('noninteractive.pdf'))
112     else:
113         draw_plot(get_directory('noninteractive.png'), size=(800, 600))
114 
115 # EOF
116
```
--- 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/examples/demo/noninteractive.py b/examples/demo/noninteractive.py
--- a/examples/demo/noninteractive.py
+++ b/examples/demo/noninteractive.py
@@ -87,7 +87,14 @@
 def get_directory(filename):
     print('Please enter a path in which to place generated plots.')
     print('Press <ENTER> to generate in the current directory.')
-    path = input('Path: ').strip()
+
+    # If python 2.7, use raw_input to parse empty string correctly
+    try:
+        get_input = raw_input
+    except NameError:
+        get_input = input
+
+    path = get_input('Path: ').strip()
 
     if len(path) > 0 and not os.path.exists(path):
         print('The given path does not exist.')

{"golden_diff": "diff --git a/examples/demo/noninteractive.py b/examples/demo/noninteractive.py\n--- a/examples/demo/noninteractive.py\n+++ b/examples/demo/noninteractive.py\n@@ -87,7 +87,14 @@\n def get_directory(filename):\n     print('Please enter a path in which to place generated plots.')\n     print('Press <ENTER> to generate in the current directory.')\n-    path = input('Path: ').strip()\n+\n+    # If python 2.7, use raw_input to parse empty string correctly\n+    try:\n+        get_input = raw_input\n+    except NameError:\n+        get_input = input\n+\n+    path = get_input('Path: ').strip()\n \n     if len(path) > 0 and not os.path.exists(path):\n         print('The given path does not exist.')\n", "issue": "Demo noninteractive.py, Errors after <ENTER>\n**Problem Description**\r\nErrors after <ENTER>\r\n**Reproduction Steps:**\r\n\r\nRun noninteractive.py and hit ENTER\r\n\r\n**Expected behavior:**\r\n```\r\n Please enter a path in which to place generated plots.\r\nPress <ENTER> to generate in the current directory.\r\nPath:\r\nTraceback (most recent call last):\r\n  File \"noninteractive.py\", line 113, in <module>\r\n    draw_plot(get_directory('noninteractive.png'), size=(800, 600))\r\n  File \"noninteractive.py\", line 90, in get_directory\r\n    path = input('Path: ').strip()\r\n  File \"<string>\", line 0\r\n\r\n    ^\r\nSyntaxError: unexpected EOF while parsing\r\n```\r\n**OS, Python version:**\r\nOSX, Python 2.7\r\n\r\nxref: #385 \n", "before_files": [{"content": "#!/usr/bin/env python\n\"\"\"\nThis demonstrates how to create a plot offscreen and save it to an image\nfile on disk.\n\"\"\"\nfrom __future__ import print_function\n\n# Standard library imports\nimport os\nimport sys\n\n# Major library imports\nfrom numpy import linspace\nfrom scipy.special import jn\n\n# Enthought library imports\nfrom traits.etsconfig.api import ETSConfig\n\n# Chaco imports\nfrom chaco.api import ArrayPlotData, Plot, PlotGraphicsContext\nfrom chaco.example_support import COLOR_PALETTE\n\nDPI = 72.0\n\n# This is a bit of a hack, to work around the fact that line widths don't scale\n# with the GraphicsContext's CTM.\ndpi_scale = DPI / 72.0\n\n\ndef create_plot():\n    numpoints = 100\n    low = -5\n    high = 15.0\n    x = linspace(low, high, numpoints)\n    pd = ArrayPlotData(index=x)\n    p = Plot(pd, bgcolor=\"oldlace\", padding=50, border_visible=True)\n    for i in range(10):\n        pd.set_data(\"y\" + str(i), jn(i, x))\n        p.plot((\"index\", \"y\" + str(i)), color=tuple(COLOR_PALETTE[i]),\n               width=2.0 * dpi_scale)\n    p.x_grid.visible = True\n    p.x_grid.line_width *= dpi_scale\n    p.y_grid.visible = True\n    p.y_grid.line_width *= dpi_scale\n    p.legend.visible = True\n    return p\n\n\ndef draw_plot(filename, size=(800, 600)):\n    container = create_plot()\n    container.outer_bounds = list(size)\n    container.do_layout(force=True)\n    gc = PlotGraphicsContext(size, dpi=DPI)\n    gc.render_component(container)\n    gc.save(filename)\n    return\n\n\ndef draw_svg(filename, size=(800, 600)):\n    from chaco.svg_graphics_context import SVGGraphicsContext\n    container = create_plot()\n    container.bounds = list(size)\n    container.do_layout(force=True)\n    gc = SVGGraphicsContext(size)\n    gc.render_component(container)\n    gc.save(filename)\n\n\ndef draw_pdf(filename, size=(800, 600)):\n    from chaco.pdf_graphics_context import PdfPlotGraphicsContext\n    container = create_plot()\n    container.outer_bounds = list(size)\n    container.do_layout(force=True)\n    gc = PdfPlotGraphicsContext(filename=filename,\n                                dest_box=(0.5, 0.5, 5.0, 5.0))\n\n    for i in range(2):\n        # draw the plot\n        gc.render_component(container)\n\n        #Start a new page for subsequent draw commands.\n        gc.add_page()\n\n    gc.save()\n\n\ndef get_directory(filename):\n    print('Please enter a path in which to place generated plots.')\n    print('Press <ENTER> to generate in the current directory.')\n    path = input('Path: ').strip()\n\n    if len(path) > 0 and not os.path.exists(path):\n        print('The given path does not exist.')\n        sys.exit()\n\n    if not os.path.isabs(path):\n        print('Creating image: ' + os.path.join(os.getcwd(), path, filename))\n\n    else:\n        print('Creating image: ' + os.path.join(path, filename))\n\n    return os.path.join(path, filename)\n\n\nif __name__ == \"__main__\":\n    if ETSConfig.kiva_backend == 'svg':\n        # Render the plot as a SVG\n        draw_svg(get_directory('noninteractive.svg'), size=(800, 600))\n    elif ETSConfig.kiva_backend == 'pdf':\n        # Render the plot as a PDF, requires on ReportLab\n        draw_pdf(get_directory('noninteractive.pdf'))\n    else:\n        draw_plot(get_directory('noninteractive.png'), size=(800, 600))\n\n# EOF\n", "path": "examples/demo/noninteractive.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\"\"\"\nThis demonstrates how to create a plot offscreen and save it to an image\nfile on disk.\n\"\"\"\nfrom __future__ import print_function\n\n# Standard library imports\nimport os\nimport sys\n\n# Major library imports\nfrom numpy import linspace\nfrom scipy.special import jn\n\n# Enthought library imports\nfrom traits.etsconfig.api import ETSConfig\n\n# Chaco imports\nfrom chaco.api import ArrayPlotData, Plot, PlotGraphicsContext\nfrom chaco.example_support import COLOR_PALETTE\n\nDPI = 72.0\n\n# This is a bit of a hack, to work around the fact that line widths don't scale\n# with the GraphicsContext's CTM.\ndpi_scale = DPI / 72.0\n\n\ndef create_plot():\n    numpoints = 100\n    low = -5\n    high = 15.0\n    x = linspace(low, high, numpoints)\n    pd = ArrayPlotData(index=x)\n    p = Plot(pd, bgcolor=\"oldlace\", padding=50, border_visible=True)\n    for i in range(10):\n        pd.set_data(\"y\" + str(i), jn(i, x))\n        p.plot((\"index\", \"y\" + str(i)), color=tuple(COLOR_PALETTE[i]),\n               width=2.0 * dpi_scale)\n    p.x_grid.visible = True\n    p.x_grid.line_width *= dpi_scale\n    p.y_grid.visible = True\n    p.y_grid.line_width *= dpi_scale\n    p.legend.visible = True\n    return p\n\n\ndef draw_plot(filename, size=(800, 600)):\n    container = create_plot()\n    container.outer_bounds = list(size)\n    container.do_layout(force=True)\n    gc = PlotGraphicsContext(size, dpi=DPI)\n    gc.render_component(container)\n    gc.save(filename)\n    return\n\n\ndef draw_svg(filename, size=(800, 600)):\n    from chaco.svg_graphics_context import SVGGraphicsContext\n    container = create_plot()\n    container.bounds = list(size)\n    container.do_layout(force=True)\n    gc = SVGGraphicsContext(size)\n    gc.render_component(container)\n    gc.save(filename)\n\n\ndef draw_pdf(filename, size=(800, 600)):\n    from chaco.pdf_graphics_context import PdfPlotGraphicsContext\n    container = create_plot()\n    container.outer_bounds = list(size)\n    container.do_layout(force=True)\n    gc = PdfPlotGraphicsContext(filename=filename,\n                                dest_box=(0.5, 0.5, 5.0, 5.0))\n\n    for i in range(2):\n        # draw the plot\n        gc.render_component(container)\n\n        #Start a new page for subsequent draw commands.\n        gc.add_page()\n\n    gc.save()\n\n\ndef get_directory(filename):\n    print('Please enter a path in which to place generated plots.')\n    print('Press <ENTER> to generate in the current directory.')\n\n    # If python 2.7, use raw_input to parse empty string correctly\n    try:\n        get_input = raw_input\n    except NameError:\n        get_input = input\n\n    path = get_input('Path: ').strip()\n\n    if len(path) > 0 and not os.path.exists(path):\n        print('The given path does not exist.')\n        sys.exit()\n\n    if not os.path.isabs(path):\n        print('Creating image: ' + os.path.join(os.getcwd(), path, filename))\n\n    else:\n        print('Creating image: ' + os.path.join(path, filename))\n\n    return os.path.join(path, filename)\n\n\nif __name__ == \"__main__\":\n    if ETSConfig.kiva_backend == 'svg':\n        # Render the plot as a SVG\n        draw_svg(get_directory('noninteractive.svg'), size=(800, 600))\n    elif ETSConfig.kiva_backend == 'pdf':\n        # Render the plot as a PDF, requires on ReportLab\n        draw_pdf(get_directory('noninteractive.pdf'))\n    else:\n        draw_plot(get_directory('noninteractive.png'), size=(800, 600))\n\n# EOF\n", "path": "examples/demo/noninteractive.py"}]}