We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
autocomplete is raising an error on mac standalone
My guess is that jedi needs to be packaged differently so that it isn't "frozen"

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setupApp.py`
Content:
```
1 #!/usr/bin/env python
2 ################
3 # see notes at bottom for requirements
4 from __future__ import absolute_import, print_function
5 import glob
6 import os
7 import sys
8 from sys import platform
9 from distutils.core import setup
10 from pkg_resources import parse_version
11 # import versioneer
12 import psychopy
13 version = psychopy.__version__
14 
15 # regenerate __init__.py only if we're in the source repos (not in a zip file)
16 try:
17     import createInitFile  # won't exist in a sdist.zip
18     writeNewInit=True
19 except:
20     writeNewInit=False
21 if writeNewInit:
22     vStr = createInitFile.createInitFile(dist='bdist')
23 
24 #define the extensions to compile if necess
25 packageData = []
26 requires = []
27 
28 if platform != 'darwin':
29     raise RuntimeError("setupApp.py is only for building Mac Standalone bundle")
30 
31 import bdist_mpkg
32 import py2app
33 resources = glob.glob('psychopy/app/Resources/*')
34 resources.append('/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h')
35 frameworks = ["/usr/lib/libxml2.2.dylib", #"libyaml.dylib",
36               "libevent.dylib", "libffi.dylib",
37               "libmp3lame.0.dylib",
38               "/usr/local/Cellar/glfw/3.2.1/lib/libglfw.3.2.dylib",
39               ]
40 opencvLibs = glob.glob(os.path.join(sys.exec_prefix, 'lib', 'libopencv*.2.4.dylib'))
41 frameworks.extend(opencvLibs)
42 
43 import macholib
44 #print("~"*60 + "macholib version: "+macholib.__version__)
45 
46 if parse_version(macholib.__version__) <= parse_version('1.7'):
47     print("Applying macholib patch...")
48     import macholib.dyld
49     import macholib.MachOGraph
50     dyld_find_1_7 = macholib.dyld.dyld_find
51     def dyld_find(name, loader=None, **kwargs):
52         #print("~"*60 + "calling alternate dyld_find")
53         if loader is not None:
54             kwargs['loader_path'] = loader
55         return dyld_find_1_7(name, **kwargs)
56     macholib.MachOGraph.dyld_find = dyld_find
57 
58 includes = ['Tkinter', 'tkFileDialog',
59             'imp', 'subprocess', 'shlex',
60             'shelve',  # for scipy.io
61             '_elementtree', 'pyexpat',  # for openpyxl
62             'hid',
63             'pyo', 'greenlet', 'zmq', 'tornado',
64             'psutil',  # for iohub
65             'tobii_research',  # need tobii_research file and tobiiresearch pkg
66             'pysoundcard', 'soundfile', 'sounddevice', 'readline',
67             'hid',
68             'xlwt',  # writes excel files for pandas
69             'vlc',  # install with pip install python-vlc
70             'msgpack_numpy',
71             'configparser',
72             ]
73 packages = ['wx', 'psychopy',
74             'pyglet', 'pytz', 'OpenGL', 'glfw',
75             'scipy', 'matplotlib', 'lxml', 'xml', 'openpyxl',
76             'moviepy', 'imageio', 'imageio_ffmpeg',
77             '_sounddevice_data', '_soundfile_data',
78             'cffi', 'pycparser',
79             'PIL',  # 'Image',
80             'objc', 'Quartz', 'AppKit', 'QTKit', 'Cocoa',
81             'Foundation', 'CoreFoundation',
82             'pkg_resources',  # needed for objc
83             'pyolib', 'pyo',
84             'requests', 'certifi', 'cryptography',
85             'pyosf',
86             # for unit testing
87             'coverage',
88             # handy external science libs
89             'serial',
90             'egi', 'pylink', 'tobiiresearch',
91             'pyxid', 'pyxid2', 'ftd2xx',  # ftd2xx is used by cedrus
92             'pandas', 'tables',  # 'cython',
93             'msgpack', 'yaml', 'gevent',  # for ioHub
94             # these aren't needed, but liked
95             'psychopy_ext', 'pyfilesec',
96             'bidi', 'arabic_reshaper',  # for right-left language conversions
97             # for Py3 compatibility
98             'future', 'past', 'lib2to3',
99             'json_tricks',  # allows saving arrays/dates in json
100             'git', 'gitlab',
101             'astunparse', 'esprima',  # for translating/adapting py/JS
102             'pylsl', 'pygaze', 'smite',
103             'cv2',
104             'badapted', 'darc_toolbox',  # adaptive methods from Ben Vincent
105             'questplus',
106             'metapensiero.pj', 'dukpy', 'macropy',
107             'jedi',
108             'psychtoolbox',
109             'freetype', 'h5py',
110             ]
111 
112 if sys.version_info.major >= 3:
113     packages.extend(['PyQt5'])
114 else:
115     # not available or not working under Python3:
116     includes.extend(['UserString', 'ioLabs', 'FileDialog'])
117     packages.extend(['PyQt4', 'labjack', 'rusocsci'])
118     # is available but py2app can't seem to find it:
119     packages.extend(['OpenGL'])
120 
121 setup(
122     app=['psychopy/app/psychopyApp.py'],
123     options=dict(py2app=dict(
124             includes=includes,
125             packages=packages,
126             excludes=['bsddb', 'jinja2', 'IPython','ipython_genutils','nbconvert',
127                       'libsz.2.dylib', 'pygame',
128                       # 'stringprep',
129                       'functools32',
130                       ],  # anything we need to forcibly exclude?
131             resources=resources,
132             argv_emulation=True,
133             site_packages=True,
134             frameworks=frameworks,
135             iconfile='psychopy/app/Resources/psychopy.icns',
136             plist=dict(
137                   CFBundleIconFile='psychopy.icns',
138                   CFBundleName               = "PsychoPy",
139                   CFBundleShortVersionString = version,  # must be in X.X.X format
140                   CFBundleVersion            = version,
141                   CFBundleExecutable         = "PsychoPy",
142                   CFBundleIdentifier         = "org.opensciencetools.psychopy",
143                   CFBundleLicense            = "GNU GPLv3+",
144                   NSHumanReadableCopyright   = "Open Science Tools Limited",
145                   CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=['*'],
146                                               CFBundleTypeRole='Editor')],
147                   LSEnvironment=dict(PATH="/usr/local/git/bin:/usr/local/bin:"
148                                           "/usr/local:/usr/bin:/usr/sbin"),
149             ),
150     ))  # end of the options dict
151 )
152 
153 
154 # ugly hack for opencv2:
155 # As of opencv 2.4.5 the cv2.so binary used rpath to a fixed
156 # location to find libs and even more annoyingly it then appended
157 # 'lib' to the rpath as well. These were fine for the packaged
158 # framework python but the libs in an app bundle are different.
159 # So, create symlinks so they appear in the same place as in framework python
160 rpath = "dist/PsychoPy.app/Contents/Resources/"
161 for libPath in opencvLibs:
162     libname = os.path.split(libPath)[-1]
163     realPath = "../../Frameworks/"+libname  # relative path (w.r.t. the fake)
164     fakePath = os.path.join(rpath, "lib", libname)
165     os.symlink(realPath, fakePath)
166 # they even did this for Python lib itself, which is in diff location
167 realPath = "../Frameworks/Python.framework/Python"  # relative to the fake path
168 fakePath = os.path.join(rpath, "Python")
169 os.symlink(realPath, fakePath)
170 
171 if writeNewInit:
172     # remove unwanted info about this system post-build
173     createInitFile.createInitFile(dist=None)
174
```
--- 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/setupApp.py b/setupApp.py
--- a/setupApp.py
+++ b/setupApp.py
@@ -104,7 +104,7 @@
             'badapted', 'darc_toolbox',  # adaptive methods from Ben Vincent
             'questplus',
             'metapensiero.pj', 'dukpy', 'macropy',
-            'jedi',
+            'jedi','parso',
             'psychtoolbox',
             'freetype', 'h5py',
             ]

{"golden_diff": "diff --git a/setupApp.py b/setupApp.py\n--- a/setupApp.py\n+++ b/setupApp.py\n@@ -104,7 +104,7 @@\n             'badapted', 'darc_toolbox',  # adaptive methods from Ben Vincent\n             'questplus',\n             'metapensiero.pj', 'dukpy', 'macropy',\n-            'jedi',\n+            'jedi','parso',\n             'psychtoolbox',\n             'freetype', 'h5py',\n             ]\n", "issue": "autocomplete is raising an error on mac standalone\nMy guess is that jedi needs to be packaged differently so that it isn't \"frozen\"\n", "before_files": [{"content": "#!/usr/bin/env python\n################\n# see notes at bottom for requirements\nfrom __future__ import absolute_import, print_function\nimport glob\nimport os\nimport sys\nfrom sys import platform\nfrom distutils.core import setup\nfrom pkg_resources import parse_version\n# import versioneer\nimport psychopy\nversion = psychopy.__version__\n\n# regenerate __init__.py only if we're in the source repos (not in a zip file)\ntry:\n    import createInitFile  # won't exist in a sdist.zip\n    writeNewInit=True\nexcept:\n    writeNewInit=False\nif writeNewInit:\n    vStr = createInitFile.createInitFile(dist='bdist')\n\n#define the extensions to compile if necess\npackageData = []\nrequires = []\n\nif platform != 'darwin':\n    raise RuntimeError(\"setupApp.py is only for building Mac Standalone bundle\")\n\nimport bdist_mpkg\nimport py2app\nresources = glob.glob('psychopy/app/Resources/*')\nresources.append('/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h')\nframeworks = [\"/usr/lib/libxml2.2.dylib\", #\"libyaml.dylib\",\n              \"libevent.dylib\", \"libffi.dylib\",\n              \"libmp3lame.0.dylib\",\n              \"/usr/local/Cellar/glfw/3.2.1/lib/libglfw.3.2.dylib\",\n              ]\nopencvLibs = glob.glob(os.path.join(sys.exec_prefix, 'lib', 'libopencv*.2.4.dylib'))\nframeworks.extend(opencvLibs)\n\nimport macholib\n#print(\"~\"*60 + \"macholib version: \"+macholib.__version__)\n\nif parse_version(macholib.__version__) <= parse_version('1.7'):\n    print(\"Applying macholib patch...\")\n    import macholib.dyld\n    import macholib.MachOGraph\n    dyld_find_1_7 = macholib.dyld.dyld_find\n    def dyld_find(name, loader=None, **kwargs):\n        #print(\"~\"*60 + \"calling alternate dyld_find\")\n        if loader is not None:\n            kwargs['loader_path'] = loader\n        return dyld_find_1_7(name, **kwargs)\n    macholib.MachOGraph.dyld_find = dyld_find\n\nincludes = ['Tkinter', 'tkFileDialog',\n            'imp', 'subprocess', 'shlex',\n            'shelve',  # for scipy.io\n            '_elementtree', 'pyexpat',  # for openpyxl\n            'hid',\n            'pyo', 'greenlet', 'zmq', 'tornado',\n            'psutil',  # for iohub\n            'tobii_research',  # need tobii_research file and tobiiresearch pkg\n            'pysoundcard', 'soundfile', 'sounddevice', 'readline',\n            'hid',\n            'xlwt',  # writes excel files for pandas\n            'vlc',  # install with pip install python-vlc\n            'msgpack_numpy',\n            'configparser',\n            ]\npackages = ['wx', 'psychopy',\n            'pyglet', 'pytz', 'OpenGL', 'glfw',\n            'scipy', 'matplotlib', 'lxml', 'xml', 'openpyxl',\n            'moviepy', 'imageio', 'imageio_ffmpeg',\n            '_sounddevice_data', '_soundfile_data',\n            'cffi', 'pycparser',\n            'PIL',  # 'Image',\n            'objc', 'Quartz', 'AppKit', 'QTKit', 'Cocoa',\n            'Foundation', 'CoreFoundation',\n            'pkg_resources',  # needed for objc\n            'pyolib', 'pyo',\n            'requests', 'certifi', 'cryptography',\n            'pyosf',\n            # for unit testing\n            'coverage',\n            # handy external science libs\n            'serial',\n            'egi', 'pylink', 'tobiiresearch',\n            'pyxid', 'pyxid2', 'ftd2xx',  # ftd2xx is used by cedrus\n            'pandas', 'tables',  # 'cython',\n            'msgpack', 'yaml', 'gevent',  # for ioHub\n            # these aren't needed, but liked\n            'psychopy_ext', 'pyfilesec',\n            'bidi', 'arabic_reshaper',  # for right-left language conversions\n            # for Py3 compatibility\n            'future', 'past', 'lib2to3',\n            'json_tricks',  # allows saving arrays/dates in json\n            'git', 'gitlab',\n            'astunparse', 'esprima',  # for translating/adapting py/JS\n            'pylsl', 'pygaze', 'smite',\n            'cv2',\n            'badapted', 'darc_toolbox',  # adaptive methods from Ben Vincent\n            'questplus',\n            'metapensiero.pj', 'dukpy', 'macropy',\n            'jedi',\n            'psychtoolbox',\n            'freetype', 'h5py',\n            ]\n\nif sys.version_info.major >= 3:\n    packages.extend(['PyQt5'])\nelse:\n    # not available or not working under Python3:\n    includes.extend(['UserString', 'ioLabs', 'FileDialog'])\n    packages.extend(['PyQt4', 'labjack', 'rusocsci'])\n    # is available but py2app can't seem to find it:\n    packages.extend(['OpenGL'])\n\nsetup(\n    app=['psychopy/app/psychopyApp.py'],\n    options=dict(py2app=dict(\n            includes=includes,\n            packages=packages,\n            excludes=['bsddb', 'jinja2', 'IPython','ipython_genutils','nbconvert',\n                      'libsz.2.dylib', 'pygame',\n                      # 'stringprep',\n                      'functools32',\n                      ],  # anything we need to forcibly exclude?\n            resources=resources,\n            argv_emulation=True,\n            site_packages=True,\n            frameworks=frameworks,\n            iconfile='psychopy/app/Resources/psychopy.icns',\n            plist=dict(\n                  CFBundleIconFile='psychopy.icns',\n                  CFBundleName               = \"PsychoPy\",\n                  CFBundleShortVersionString = version,  # must be in X.X.X format\n                  CFBundleVersion            = version,\n                  CFBundleExecutable         = \"PsychoPy\",\n                  CFBundleIdentifier         = \"org.opensciencetools.psychopy\",\n                  CFBundleLicense            = \"GNU GPLv3+\",\n                  NSHumanReadableCopyright   = \"Open Science Tools Limited\",\n                  CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=['*'],\n                                              CFBundleTypeRole='Editor')],\n                  LSEnvironment=dict(PATH=\"/usr/local/git/bin:/usr/local/bin:\"\n                                          \"/usr/local:/usr/bin:/usr/sbin\"),\n            ),\n    ))  # end of the options dict\n)\n\n\n# ugly hack for opencv2:\n# As of opencv 2.4.5 the cv2.so binary used rpath to a fixed\n# location to find libs and even more annoyingly it then appended\n# 'lib' to the rpath as well. These were fine for the packaged\n# framework python but the libs in an app bundle are different.\n# So, create symlinks so they appear in the same place as in framework python\nrpath = \"dist/PsychoPy.app/Contents/Resources/\"\nfor libPath in opencvLibs:\n    libname = os.path.split(libPath)[-1]\n    realPath = \"../../Frameworks/\"+libname  # relative path (w.r.t. the fake)\n    fakePath = os.path.join(rpath, \"lib\", libname)\n    os.symlink(realPath, fakePath)\n# they even did this for Python lib itself, which is in diff location\nrealPath = \"../Frameworks/Python.framework/Python\"  # relative to the fake path\nfakePath = os.path.join(rpath, \"Python\")\nos.symlink(realPath, fakePath)\n\nif writeNewInit:\n    # remove unwanted info about this system post-build\n    createInitFile.createInitFile(dist=None)\n", "path": "setupApp.py"}], "after_files": [{"content": "#!/usr/bin/env python\n################\n# see notes at bottom for requirements\nfrom __future__ import absolute_import, print_function\nimport glob\nimport os\nimport sys\nfrom sys import platform\nfrom distutils.core import setup\nfrom pkg_resources import parse_version\n# import versioneer\nimport psychopy\nversion = psychopy.__version__\n\n# regenerate __init__.py only if we're in the source repos (not in a zip file)\ntry:\n    import createInitFile  # won't exist in a sdist.zip\n    writeNewInit=True\nexcept:\n    writeNewInit=False\nif writeNewInit:\n    vStr = createInitFile.createInitFile(dist='bdist')\n\n#define the extensions to compile if necess\npackageData = []\nrequires = []\n\nif platform != 'darwin':\n    raise RuntimeError(\"setupApp.py is only for building Mac Standalone bundle\")\n\nimport bdist_mpkg\nimport py2app\nresources = glob.glob('psychopy/app/Resources/*')\nresources.append('/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h')\nframeworks = [\"/usr/lib/libxml2.2.dylib\", #\"libyaml.dylib\",\n              \"libevent.dylib\", \"libffi.dylib\",\n              \"libmp3lame.0.dylib\",\n              \"/usr/local/Cellar/glfw/3.2.1/lib/libglfw.3.2.dylib\",\n              ]\nopencvLibs = glob.glob(os.path.join(sys.exec_prefix, 'lib', 'libopencv*.2.4.dylib'))\nframeworks.extend(opencvLibs)\n\nimport macholib\n#print(\"~\"*60 + \"macholib version: \"+macholib.__version__)\n\nif parse_version(macholib.__version__) <= parse_version('1.7'):\n    print(\"Applying macholib patch...\")\n    import macholib.dyld\n    import macholib.MachOGraph\n    dyld_find_1_7 = macholib.dyld.dyld_find\n    def dyld_find(name, loader=None, **kwargs):\n        #print(\"~\"*60 + \"calling alternate dyld_find\")\n        if loader is not None:\n            kwargs['loader_path'] = loader\n        return dyld_find_1_7(name, **kwargs)\n    macholib.MachOGraph.dyld_find = dyld_find\n\nincludes = ['Tkinter', 'tkFileDialog',\n            'imp', 'subprocess', 'shlex',\n            'shelve',  # for scipy.io\n            '_elementtree', 'pyexpat',  # for openpyxl\n            'hid',\n            'pyo', 'greenlet', 'zmq', 'tornado',\n            'psutil',  # for iohub\n            'tobii_research',  # need tobii_research file and tobiiresearch pkg\n            'pysoundcard', 'soundfile', 'sounddevice', 'readline',\n            'hid',\n            'xlwt',  # writes excel files for pandas\n            'vlc',  # install with pip install python-vlc\n            'msgpack_numpy',\n            'configparser',\n            ]\npackages = ['wx', 'psychopy',\n            'pyglet', 'pytz', 'OpenGL', 'glfw',\n            'scipy', 'matplotlib', 'lxml', 'xml', 'openpyxl',\n            'moviepy', 'imageio', 'imageio_ffmpeg',\n            '_sounddevice_data', '_soundfile_data',\n            'cffi', 'pycparser',\n            'PIL',  # 'Image',\n            'objc', 'Quartz', 'AppKit', 'QTKit', 'Cocoa',\n            'Foundation', 'CoreFoundation',\n            'pkg_resources',  # needed for objc\n            'pyolib', 'pyo',\n            'requests', 'certifi', 'cryptography',\n            'pyosf',\n            # for unit testing\n            'coverage',\n            # handy external science libs\n            'serial',\n            'egi', 'pylink', 'tobiiresearch',\n            'pyxid', 'pyxid2', 'ftd2xx',  # ftd2xx is used by cedrus\n            'pandas', 'tables',  # 'cython',\n            'msgpack', 'yaml', 'gevent',  # for ioHub\n            # these aren't needed, but liked\n            'psychopy_ext', 'pyfilesec',\n            'bidi', 'arabic_reshaper',  # for right-left language conversions\n            # for Py3 compatibility\n            'future', 'past', 'lib2to3',\n            'json_tricks',  # allows saving arrays/dates in json\n            'git', 'gitlab',\n            'astunparse', 'esprima',  # for translating/adapting py/JS\n            'pylsl', 'pygaze', 'smite',\n            'cv2',\n            'badapted', 'darc_toolbox',  # adaptive methods from Ben Vincent\n            'questplus',\n            'metapensiero.pj', 'dukpy', 'macropy',\n            'jedi','parso',\n            'psychtoolbox',\n            'freetype', 'h5py',\n            ]\n\nif sys.version_info.major >= 3:\n    packages.extend(['PyQt5'])\nelse:\n    # not available or not working under Python3:\n    includes.extend(['UserString', 'ioLabs', 'FileDialog'])\n    packages.extend(['PyQt4', 'labjack', 'rusocsci'])\n    # is available but py2app can't seem to find it:\n    packages.extend(['OpenGL'])\n\nsetup(\n    app=['psychopy/app/psychopyApp.py'],\n    options=dict(py2app=dict(\n            includes=includes,\n            packages=packages,\n            excludes=['bsddb', 'jinja2', 'IPython','ipython_genutils','nbconvert',\n                      'libsz.2.dylib', 'pygame',\n                      # 'stringprep',\n                      'functools32',\n                      ],  # anything we need to forcibly exclude?\n            resources=resources,\n            argv_emulation=True,\n            site_packages=True,\n            frameworks=frameworks,\n            iconfile='psychopy/app/Resources/psychopy.icns',\n            plist=dict(\n                  CFBundleIconFile='psychopy.icns',\n                  CFBundleName               = \"PsychoPy\",\n                  CFBundleShortVersionString = version,  # must be in X.X.X format\n                  CFBundleVersion            = version,\n                  CFBundleExecutable         = \"PsychoPy\",\n                  CFBundleIdentifier         = \"org.opensciencetools.psychopy\",\n                  CFBundleLicense            = \"GNU GPLv3+\",\n                  NSHumanReadableCopyright   = \"Open Science Tools Limited\",\n                  CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=['*'],\n                                              CFBundleTypeRole='Editor')],\n                  LSEnvironment=dict(PATH=\"/usr/local/git/bin:/usr/local/bin:\"\n                                          \"/usr/local:/usr/bin:/usr/sbin\"),\n            ),\n    ))  # end of the options dict\n)\n\n\n# ugly hack for opencv2:\n# As of opencv 2.4.5 the cv2.so binary used rpath to a fixed\n# location to find libs and even more annoyingly it then appended\n# 'lib' to the rpath as well. These were fine for the packaged\n# framework python but the libs in an app bundle are different.\n# So, create symlinks so they appear in the same place as in framework python\nrpath = \"dist/PsychoPy.app/Contents/Resources/\"\nfor libPath in opencvLibs:\n    libname = os.path.split(libPath)[-1]\n    realPath = \"../../Frameworks/\"+libname  # relative path (w.r.t. the fake)\n    fakePath = os.path.join(rpath, \"lib\", libname)\n    os.symlink(realPath, fakePath)\n# they even did this for Python lib itself, which is in diff location\nrealPath = \"../Frameworks/Python.framework/Python\"  # relative to the fake path\nfakePath = os.path.join(rpath, \"Python\")\nos.symlink(realPath, fakePath)\n\nif writeNewInit:\n    # remove unwanted info about this system post-build\n    createInitFile.createInitFile(dist=None)\n", "path": "setupApp.py"}]}