prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  psychopyApp won't start with Matplotlib 1.5 installed
  See http://discourse.psychopy.org/t/mac-specific-help/1540/3
  
  We need to figure out
  - whether this problem is Anaconda-specific (and would require fixing upstream)
  - whether this problem is Mac-specific
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `psychopy/app/psychopyApp.py`
  Content:
  ```
  1 #!/usr/bin/env python2
  2 
  3 # Part of the PsychoPy library
  4 # Copyright (C) 2015 Jonathan Peirce
  5 # Distributed under the terms of the GNU General Public License (GPL).
  6 
  7 from __future__ import absolute_import, print_function
  8 
  9 import sys
  10 from psychopy.app._psychopyApp import PsychoPyApp, __version__
  11 
  12 # NB the PsychoPyApp classes moved to _psychopyApp.py as of version 1.78.00
  13 # to allow for better upgrading possibilities from the mac app bundle. this
  14 # file now used solely as a launcher for the app, not as the app itself.
  15 
  16 if __name__ == '__main__':
  17     if '-x' in sys.argv:
  18         # run a .py script from the command line using StandAlone python
  19         targetScript = sys.argv[sys.argv.index('-x') + 1]
  20         from psychopy import core
  21         import os
  22         core.shellCall([sys.executable, os.path.abspath(targetScript)])
  23         sys.exit()
  24     if '-v' in sys.argv or '--version' in sys.argv:
  25         info = 'PsychoPy2, version %s (c)Jonathan Peirce 2015, GNU GPL license'
  26         print(info % __version__)
  27         sys.exit()
  28     if '-h' in sys.argv or '--help' in sys.argv:
  29         print("""Starts the PsychoPy2 application.
  30 
  31 Usage:  python PsychoPy.py [options] [file]
  32 
  33 Without options or files provided this starts PsychoPy using prefs to
  34 decide on the view(s) to open.  If optional [file] is provided action
  35 depends on the type of the [file]:
  36 
  37  Python script 'file.py' -- opens coder
  38 
  39  Experiment design 'file.psyexp' -- opens builder
  40 
  41 Options:
  42     -c, --coder, coder       opens coder view only
  43     -b, --builder, builder   opens builder view only
  44     -x script.py             execute script.py using StandAlone python
  45 
  46     -v, --version    prints version and exits
  47     -h, --help       prints this help and exit
  48 
  49     --firstrun       launches configuration wizard
  50     --no-splash      suppresses splash screen
  51 
  52 """)
  53         sys.exit()
  54 
  55     else:
  56         showSplash = True
  57         if '--no-splash' in sys.argv:
  58             showSplash = False
  59             del sys.argv[sys.argv.index('--no-splash')]
  60         app = PsychoPyApp(0, showSplash=showSplash)
  61         app.MainLoop()
  62
  ```
  --- 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/psychopy/app/psychopyApp.py b/psychopy/app/psychopyApp.py
  --- a/psychopy/app/psychopyApp.py
  +++ b/psychopy/app/psychopyApp.py
  @@ -8,6 +8,8 @@
   
   import sys
   from psychopy.app._psychopyApp import PsychoPyApp, __version__
  +# fix OS X locale-bug on startup: sets locale to LC_ALL (must be defined!)
  +import psychopy.locale_setup  # noqa
   
   # NB the PsychoPyApp classes moved to _psychopyApp.py as of version 1.78.00
   # to allow for better upgrading possibilities from the mac app bundle. this
  
verification_info: {"golden_diff": "diff --git a/psychopy/app/psychopyApp.py b/psychopy/app/psychopyApp.py\n--- a/psychopy/app/psychopyApp.py\n+++ b/psychopy/app/psychopyApp.py\n@@ -8,6 +8,8 @@\n \n import sys\n from psychopy.app._psychopyApp import PsychoPyApp, __version__\n+# fix OS X locale-bug on startup: sets locale to LC_ALL (must be defined!)\n+import psychopy.locale_setup  # noqa\n \n # NB the PsychoPyApp classes moved to _psychopyApp.py as of version 1.78.00\n # to allow for better upgrading possibilities from the mac app bundle. this\n", "issue": "psychopyApp won't start with Matplotlib 1.5 installed\nSee http://discourse.psychopy.org/t/mac-specific-help/1540/3\r\n\r\nWe need to figure out\r\n- whether this problem is Anaconda-specific (and would require fixing upstream)\r\n- whether this problem is Mac-specific\n", "before_files": [{"content": "#!/usr/bin/env python2\n\n# Part of the PsychoPy library\n# Copyright (C) 2015 Jonathan Peirce\n# Distributed under the terms of the GNU General Public License (GPL).\n\nfrom __future__ import absolute_import, print_function\n\nimport sys\nfrom psychopy.app._psychopyApp import PsychoPyApp, __version__\n\n# NB the PsychoPyApp classes moved to _psychopyApp.py as of version 1.78.00\n# to allow for better upgrading possibilities from the mac app bundle. this\n# file now used solely as a launcher for the app, not as the app itself.\n\nif __name__ == '__main__':\n    if '-x' in sys.argv:\n        # run a .py script from the command line using StandAlone python\n        targetScript = sys.argv[sys.argv.index('-x') + 1]\n        from psychopy import core\n        import os\n        core.shellCall([sys.executable, os.path.abspath(targetScript)])\n        sys.exit()\n    if '-v' in sys.argv or '--version' in sys.argv:\n        info = 'PsychoPy2, version %s (c)Jonathan Peirce 2015, GNU GPL license'\n        print(info % __version__)\n        sys.exit()\n    if '-h' in sys.argv or '--help' in sys.argv:\n        print(\"\"\"Starts the PsychoPy2 application.\n\nUsage:  python PsychoPy.py [options] [file]\n\nWithout options or files provided this starts PsychoPy using prefs to\ndecide on the view(s) to open.  If optional [file] is provided action\ndepends on the type of the [file]:\n\n Python script 'file.py' -- opens coder\n\n Experiment design 'file.psyexp' -- opens builder\n\nOptions:\n    -c, --coder, coder       opens coder view only\n    -b, --builder, builder   opens builder view only\n    -x script.py             execute script.py using StandAlone python\n\n    -v, --version    prints version and exits\n    -h, --help       prints this help and exit\n\n    --firstrun       launches configuration wizard\n    --no-splash      suppresses splash screen\n\n\"\"\")\n        sys.exit()\n\n    else:\n        showSplash = True\n        if '--no-splash' in sys.argv:\n            showSplash = False\n            del sys.argv[sys.argv.index('--no-splash')]\n        app = PsychoPyApp(0, showSplash=showSplash)\n        app.MainLoop()\n", "path": "psychopy/app/psychopyApp.py"}], "after_files": [{"content": "#!/usr/bin/env python2\n\n# Part of the PsychoPy library\n# Copyright (C) 2015 Jonathan Peirce\n# Distributed under the terms of the GNU General Public License (GPL).\n\nfrom __future__ import absolute_import, print_function\n\nimport sys\nfrom psychopy.app._psychopyApp import PsychoPyApp, __version__\n# fix OS X locale-bug on startup: sets locale to LC_ALL (must be defined!)\nimport psychopy.locale_setup  # noqa\n\n# NB the PsychoPyApp classes moved to _psychopyApp.py as of version 1.78.00\n# to allow for better upgrading possibilities from the mac app bundle. this\n# file now used solely as a launcher for the app, not as the app itself.\n\nif __name__ == '__main__':\n    if '-x' in sys.argv:\n        # run a .py script from the command line using StandAlone python\n        targetScript = sys.argv[sys.argv.index('-x') + 1]\n        from psychopy import core\n        import os\n        core.shellCall([sys.executable, os.path.abspath(targetScript)])\n        sys.exit()\n    if '-v' in sys.argv or '--version' in sys.argv:\n        info = 'PsychoPy2, version %s (c)Jonathan Peirce 2015, GNU GPL license'\n        print(info % __version__)\n        sys.exit()\n    if '-h' in sys.argv or '--help' in sys.argv:\n        print(\"\"\"Starts the PsychoPy2 application.\n\nUsage:  python PsychoPy.py [options] [file]\n\nWithout options or files provided this starts PsychoPy using prefs to\ndecide on the view(s) to open.  If optional [file] is provided action\ndepends on the type of the [file]:\n\n Python script 'file.py' -- opens coder\n\n Experiment design 'file.psyexp' -- opens builder\n\nOptions:\n    -c, --coder, coder       opens coder view only\n    -b, --builder, builder   opens builder view only\n    -x script.py             execute script.py using StandAlone python\n\n    -v, --version    prints version and exits\n    -h, --help       prints this help and exit\n\n    --firstrun       launches configuration wizard\n    --no-splash      suppresses splash screen\n\n\"\"\")\n        sys.exit()\n\n    else:\n        showSplash = True\n        if '--no-splash' in sys.argv:\n            showSplash = False\n            del sys.argv[sys.argv.index('--no-splash')]\n        app = PsychoPyApp(0, showSplash=showSplash)\n        app.MainLoop()\n", "path": "psychopy/app/psychopyApp.py"}]}