We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Spyder not starting in macOS because pyopengl is present


I updated python and spyder using "conda update spyder" and "conda update python" respectively on MacOSX. Is this a python error or a spyder error? 

Please find attached the conda list output listing the versions.

Thanks for your support. 
--------
Traceback (most recent call last):
File "/Users/Nagraj/anaconda3/bin/spyder", line 7, in 
[conda_list.txt](https://github.com/spyder-ide/spyder/files/1590875/conda_list.txt)

from spyder.app.start import main
File "/Users/Nagraj/anaconda3/lib/python3.6/site-packages/spyder/app/start.py", line 19, in 
from OpenGL import GL
File "/Users/Nagraj/anaconda3/lib/python3.6/site-packages/OpenGL/GL/__init__.py", line 3, in 
from OpenGL import error as _error
File "/Users/Nagraj/anaconda3/lib/python3.6/site-packages/OpenGL/error.py", line 12, in 
from OpenGL import platform, _configflags
File "/Users/Nagraj/anaconda3/lib/python3.6/site-packages/OpenGL/platform/__init__.py", line 35, in 
_load()
File "/Users/Nagraj/anaconda3/lib/python3.6/site-packages/OpenGL/platform/__init__.py", line 29, in _load
plugin = plugin_class()
TypeError: 'NoneType' object is not callable


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `spyder/app/start.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 # Std imports
4 import os
5 import os.path as osp
6 import random
7 import socket
8 import sys
9 import time
10 
11 # To prevent a race condition with ZMQ
12 # See issue 5324
13 import zmq
14 
15 # This import is needed to fix errors with OpenGL when installed using pip
16 # See issue 3332
17 try:
18     from OpenGL import GL
19 except ImportError:
20     # pyopengl is not present when installed using conda
21     pass
22 
23 # Local imports
24 from spyder.app.cli_options import get_options
25 from spyder.config.base import get_conf_path, running_in_mac_app
26 from spyder.config.main import CONF
27 from spyder.utils.external import lockfile
28 from spyder.py3compat import is_unicode
29 
30 
31 def send_args_to_spyder(args):
32     """
33     Simple socket client used to send the args passed to the Spyder 
34     executable to an already running instance.
35 
36     Args can be Python scripts or files with these extensions: .spydata, .mat,
37     .npy, or .h5, which can be imported by the Variable Explorer.
38     """
39     port = CONF.get('main', 'open_files_port')
40 
41     # Wait ~50 secs for the server to be up
42     # Taken from http://stackoverflow.com/a/4766598/438386
43     for _x in range(200):
44         try:
45             for arg in args:
46                 client = socket.socket(socket.AF_INET, socket.SOCK_STREAM,
47                                        socket.IPPROTO_TCP)
48                 client.connect(("127.0.0.1", port))
49                 if is_unicode(arg):
50                     arg = arg.encode('utf-8')
51                 client.send(osp.abspath(arg))
52                 client.close()
53         except socket.error:
54             time.sleep(0.25)
55             continue
56         break
57 
58 
59 def main():
60     """
61     Start Spyder application.
62 
63     If single instance mode is turned on (default behavior) and an instance of
64     Spyder is already running, this will just parse and send command line
65     options to the application.
66     """
67     # Parse command line options
68     options, args = get_options()
69 
70     # Store variable to be used in self.restart (restart spyder instance)
71     os.environ['SPYDER_ARGS'] = str(sys.argv[1:])
72 
73     #==========================================================================
74     # Proper high DPI scaling is available in Qt >= 5.6.0. This attibute must
75     # be set before creating the application.
76     #==========================================================================
77     if CONF.get('main', 'high_dpi_custom_scale_factor'):
78         factors = str(CONF.get('main', 'high_dpi_custom_scale_factors'))
79         f = list(filter(None, factors.split(';')))
80         if len(f) == 1:
81             os.environ['QT_SCALE_FACTOR'] = f[0]
82         else:
83             os.environ['QT_SCREEN_SCALE_FACTORS'] = factors
84     else:
85         os.environ['QT_SCALE_FACTOR'] = ''
86         os.environ['QT_SCREEN_SCALE_FACTORS'] = ''
87 
88     # Prevent Spyder from crashing in macOS if locale is not defined
89     if sys.platform == 'darwin':
90         LANG = os.environ.get('LANG')
91         LC_ALL = os.environ.get('LC_ALL')
92         if bool(LANG) and not bool(LC_ALL):
93             LC_ALL = LANG
94         elif not bool(LANG) and bool(LC_ALL):
95             LANG = LC_ALL
96         else:
97             LANG = LC_ALL = 'en_US.UTF-8'
98 
99         os.environ['LANG'] = LANG
100         os.environ['LC_ALL'] = LC_ALL
101 
102     if CONF.get('main', 'single_instance') and not options.new_instance \
103       and not options.reset_config_files and not running_in_mac_app():
104         # Minimal delay (0.1-0.2 secs) to avoid that several
105         # instances started at the same time step in their
106         # own foots while trying to create the lock file
107         time.sleep(random.randrange(1000, 2000, 90)/10000.)
108 
109         # Lock file creation
110         lock_file = get_conf_path('spyder.lock')
111         lock = lockfile.FilesystemLock(lock_file)
112 
113         # Try to lock spyder.lock. If it's *possible* to do it, then
114         # there is no previous instance running and we can start a
115         # new one. If *not*, then there is an instance already
116         # running, which is locking that file
117         try:
118             lock_created = lock.lock()
119         except:
120             # If locking fails because of errors in the lockfile
121             # module, try to remove a possibly stale spyder.lock.
122             # This is reported to solve all problems with
123             # lockfile (See issue 2363)
124             try:
125                 if os.name == 'nt':
126                     if osp.isdir(lock_file):
127                         import shutil
128                         shutil.rmtree(lock_file, ignore_errors=True)
129                 else:
130                     if osp.islink(lock_file):
131                         os.unlink(lock_file)
132             except:
133                 pass
134 
135             # Then start Spyder as usual and *don't* continue
136             # executing this script because it doesn't make
137             # sense
138             from spyder.app import mainwindow
139             mainwindow.main()
140             return
141 
142         if lock_created:
143             # Start a new instance
144             from spyder.app import mainwindow
145             mainwindow.main()
146         else:
147             # Pass args to Spyder or print an informative
148             # message
149             if args:
150                 send_args_to_spyder(args)
151             else:
152                 print("Spyder is already running. If you want to open a new \n"
153                       "instance, please pass to it the --new-instance option")
154     else:
155         from spyder.app import mainwindow
156         mainwindow.main()
157 
158 
159 if __name__ == "__main__":
160     main()
161
```
--- 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/spyder/app/start.py b/spyder/app/start.py
--- a/spyder/app/start.py
+++ b/spyder/app/start.py
@@ -16,8 +16,7 @@
 # See issue 3332
 try:
     from OpenGL import GL
-except ImportError:
-    # pyopengl is not present when installed using conda
+except:
     pass
 
 # Local imports

{"golden_diff": "diff --git a/spyder/app/start.py b/spyder/app/start.py\n--- a/spyder/app/start.py\n+++ b/spyder/app/start.py\n@@ -16,8 +16,7 @@\n # See issue 3332\r\n try:\r\n     from OpenGL import GL\r\n-except ImportError:\r\n-    # pyopengl is not present when installed using conda\r\n+except:\r\n     pass\r\n \r\n # Local imports\n", "issue": "Spyder not starting in macOS because pyopengl is present\n\r\n\r\nI updated python and spyder using \"conda update spyder\" and \"conda update python\" respectively on MacOSX. Is this a python error or a spyder error? \r\n\r\nPlease find attached the conda list output listing the versions.\r\n\r\nThanks for your support. \r\n--------\r\nTraceback (most recent call last):\r\nFile \"/Users/Nagraj/anaconda3/bin/spyder\", line 7, in \r\n[conda_list.txt](https://github.com/spyder-ide/spyder/files/1590875/conda_list.txt)\r\n\r\nfrom spyder.app.start import main\r\nFile \"/Users/Nagraj/anaconda3/lib/python3.6/site-packages/spyder/app/start.py\", line 19, in \r\nfrom OpenGL import GL\r\nFile \"/Users/Nagraj/anaconda3/lib/python3.6/site-packages/OpenGL/GL/__init__.py\", line 3, in \r\nfrom OpenGL import error as _error\r\nFile \"/Users/Nagraj/anaconda3/lib/python3.6/site-packages/OpenGL/error.py\", line 12, in \r\nfrom OpenGL import platform, _configflags\r\nFile \"/Users/Nagraj/anaconda3/lib/python3.6/site-packages/OpenGL/platform/__init__.py\", line 35, in \r\n_load()\r\nFile \"/Users/Nagraj/anaconda3/lib/python3.6/site-packages/OpenGL/platform/__init__.py\", line 29, in _load\r\nplugin = plugin_class()\r\nTypeError: 'NoneType' object is not callable\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\r\n\r\n# Std imports\r\nimport os\r\nimport os.path as osp\r\nimport random\r\nimport socket\r\nimport sys\r\nimport time\r\n\r\n# To prevent a race condition with ZMQ\r\n# See issue 5324\r\nimport zmq\r\n\r\n# This import is needed to fix errors with OpenGL when installed using pip\r\n# See issue 3332\r\ntry:\r\n    from OpenGL import GL\r\nexcept ImportError:\r\n    # pyopengl is not present when installed using conda\r\n    pass\r\n\r\n# Local imports\r\nfrom spyder.app.cli_options import get_options\r\nfrom spyder.config.base import get_conf_path, running_in_mac_app\r\nfrom spyder.config.main import CONF\r\nfrom spyder.utils.external import lockfile\r\nfrom spyder.py3compat import is_unicode\r\n\r\n\r\ndef send_args_to_spyder(args):\r\n    \"\"\"\r\n    Simple socket client used to send the args passed to the Spyder \r\n    executable to an already running instance.\r\n\r\n    Args can be Python scripts or files with these extensions: .spydata, .mat,\r\n    .npy, or .h5, which can be imported by the Variable Explorer.\r\n    \"\"\"\r\n    port = CONF.get('main', 'open_files_port')\r\n\r\n    # Wait ~50 secs for the server to be up\r\n    # Taken from http://stackoverflow.com/a/4766598/438386\r\n    for _x in range(200):\r\n        try:\r\n            for arg in args:\r\n                client = socket.socket(socket.AF_INET, socket.SOCK_STREAM,\r\n                                       socket.IPPROTO_TCP)\r\n                client.connect((\"127.0.0.1\", port))\r\n                if is_unicode(arg):\r\n                    arg = arg.encode('utf-8')\r\n                client.send(osp.abspath(arg))\r\n                client.close()\r\n        except socket.error:\r\n            time.sleep(0.25)\r\n            continue\r\n        break\r\n\r\n\r\ndef main():\r\n    \"\"\"\r\n    Start Spyder application.\r\n\r\n    If single instance mode is turned on (default behavior) and an instance of\r\n    Spyder is already running, this will just parse and send command line\r\n    options to the application.\r\n    \"\"\"\r\n    # Parse command line options\r\n    options, args = get_options()\r\n\r\n    # Store variable to be used in self.restart (restart spyder instance)\r\n    os.environ['SPYDER_ARGS'] = str(sys.argv[1:])\r\n\r\n    #==========================================================================\r\n    # Proper high DPI scaling is available in Qt >= 5.6.0. This attibute must\r\n    # be set before creating the application.\r\n    #==========================================================================\r\n    if CONF.get('main', 'high_dpi_custom_scale_factor'):\r\n        factors = str(CONF.get('main', 'high_dpi_custom_scale_factors'))\r\n        f = list(filter(None, factors.split(';')))\r\n        if len(f) == 1:\r\n            os.environ['QT_SCALE_FACTOR'] = f[0]\r\n        else:\r\n            os.environ['QT_SCREEN_SCALE_FACTORS'] = factors\r\n    else:\r\n        os.environ['QT_SCALE_FACTOR'] = ''\r\n        os.environ['QT_SCREEN_SCALE_FACTORS'] = ''\r\n\r\n    # Prevent Spyder from crashing in macOS if locale is not defined\r\n    if sys.platform == 'darwin':\r\n        LANG = os.environ.get('LANG')\r\n        LC_ALL = os.environ.get('LC_ALL')\r\n        if bool(LANG) and not bool(LC_ALL):\r\n            LC_ALL = LANG\r\n        elif not bool(LANG) and bool(LC_ALL):\r\n            LANG = LC_ALL\r\n        else:\r\n            LANG = LC_ALL = 'en_US.UTF-8'\r\n\r\n        os.environ['LANG'] = LANG\r\n        os.environ['LC_ALL'] = LC_ALL\r\n\r\n    if CONF.get('main', 'single_instance') and not options.new_instance \\\r\n      and not options.reset_config_files and not running_in_mac_app():\r\n        # Minimal delay (0.1-0.2 secs) to avoid that several\r\n        # instances started at the same time step in their\r\n        # own foots while trying to create the lock file\r\n        time.sleep(random.randrange(1000, 2000, 90)/10000.)\r\n\r\n        # Lock file creation\r\n        lock_file = get_conf_path('spyder.lock')\r\n        lock = lockfile.FilesystemLock(lock_file)\r\n\r\n        # Try to lock spyder.lock. If it's *possible* to do it, then\r\n        # there is no previous instance running and we can start a\r\n        # new one. If *not*, then there is an instance already\r\n        # running, which is locking that file\r\n        try:\r\n            lock_created = lock.lock()\r\n        except:\r\n            # If locking fails because of errors in the lockfile\r\n            # module, try to remove a possibly stale spyder.lock.\r\n            # This is reported to solve all problems with\r\n            # lockfile (See issue 2363)\r\n            try:\r\n                if os.name == 'nt':\r\n                    if osp.isdir(lock_file):\r\n                        import shutil\r\n                        shutil.rmtree(lock_file, ignore_errors=True)\r\n                else:\r\n                    if osp.islink(lock_file):\r\n                        os.unlink(lock_file)\r\n            except:\r\n                pass\r\n\r\n            # Then start Spyder as usual and *don't* continue\r\n            # executing this script because it doesn't make\r\n            # sense\r\n            from spyder.app import mainwindow\r\n            mainwindow.main()\r\n            return\r\n\r\n        if lock_created:\r\n            # Start a new instance\r\n            from spyder.app import mainwindow\r\n            mainwindow.main()\r\n        else:\r\n            # Pass args to Spyder or print an informative\r\n            # message\r\n            if args:\r\n                send_args_to_spyder(args)\r\n            else:\r\n                print(\"Spyder is already running. If you want to open a new \\n\"\r\n                      \"instance, please pass to it the --new-instance option\")\r\n    else:\r\n        from spyder.app import mainwindow\r\n        mainwindow.main()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r\n", "path": "spyder/app/start.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\r\n\r\n# Std imports\r\nimport os\r\nimport os.path as osp\r\nimport random\r\nimport socket\r\nimport sys\r\nimport time\r\n\r\n# To prevent a race condition with ZMQ\r\n# See issue 5324\r\nimport zmq\r\n\r\n# This import is needed to fix errors with OpenGL when installed using pip\r\n# See issue 3332\r\ntry:\r\n    from OpenGL import GL\r\nexcept:\r\n    pass\r\n\r\n# Local imports\r\nfrom spyder.app.cli_options import get_options\r\nfrom spyder.config.base import get_conf_path, running_in_mac_app\r\nfrom spyder.config.main import CONF\r\nfrom spyder.utils.external import lockfile\r\nfrom spyder.py3compat import is_unicode\r\n\r\n\r\ndef send_args_to_spyder(args):\r\n    \"\"\"\r\n    Simple socket client used to send the args passed to the Spyder \r\n    executable to an already running instance.\r\n\r\n    Args can be Python scripts or files with these extensions: .spydata, .mat,\r\n    .npy, or .h5, which can be imported by the Variable Explorer.\r\n    \"\"\"\r\n    port = CONF.get('main', 'open_files_port')\r\n\r\n    # Wait ~50 secs for the server to be up\r\n    # Taken from http://stackoverflow.com/a/4766598/438386\r\n    for _x in range(200):\r\n        try:\r\n            for arg in args:\r\n                client = socket.socket(socket.AF_INET, socket.SOCK_STREAM,\r\n                                       socket.IPPROTO_TCP)\r\n                client.connect((\"127.0.0.1\", port))\r\n                if is_unicode(arg):\r\n                    arg = arg.encode('utf-8')\r\n                client.send(osp.abspath(arg))\r\n                client.close()\r\n        except socket.error:\r\n            time.sleep(0.25)\r\n            continue\r\n        break\r\n\r\n\r\ndef main():\r\n    \"\"\"\r\n    Start Spyder application.\r\n\r\n    If single instance mode is turned on (default behavior) and an instance of\r\n    Spyder is already running, this will just parse and send command line\r\n    options to the application.\r\n    \"\"\"\r\n    # Parse command line options\r\n    options, args = get_options()\r\n\r\n    # Store variable to be used in self.restart (restart spyder instance)\r\n    os.environ['SPYDER_ARGS'] = str(sys.argv[1:])\r\n\r\n    #==========================================================================\r\n    # Proper high DPI scaling is available in Qt >= 5.6.0. This attibute must\r\n    # be set before creating the application.\r\n    #==========================================================================\r\n    if CONF.get('main', 'high_dpi_custom_scale_factor'):\r\n        factors = str(CONF.get('main', 'high_dpi_custom_scale_factors'))\r\n        f = list(filter(None, factors.split(';')))\r\n        if len(f) == 1:\r\n            os.environ['QT_SCALE_FACTOR'] = f[0]\r\n        else:\r\n            os.environ['QT_SCREEN_SCALE_FACTORS'] = factors\r\n    else:\r\n        os.environ['QT_SCALE_FACTOR'] = ''\r\n        os.environ['QT_SCREEN_SCALE_FACTORS'] = ''\r\n\r\n    # Prevent Spyder from crashing in macOS if locale is not defined\r\n    if sys.platform == 'darwin':\r\n        LANG = os.environ.get('LANG')\r\n        LC_ALL = os.environ.get('LC_ALL')\r\n        if bool(LANG) and not bool(LC_ALL):\r\n            LC_ALL = LANG\r\n        elif not bool(LANG) and bool(LC_ALL):\r\n            LANG = LC_ALL\r\n        else:\r\n            LANG = LC_ALL = 'en_US.UTF-8'\r\n\r\n        os.environ['LANG'] = LANG\r\n        os.environ['LC_ALL'] = LC_ALL\r\n\r\n    if CONF.get('main', 'single_instance') and not options.new_instance \\\r\n      and not options.reset_config_files and not running_in_mac_app():\r\n        # Minimal delay (0.1-0.2 secs) to avoid that several\r\n        # instances started at the same time step in their\r\n        # own foots while trying to create the lock file\r\n        time.sleep(random.randrange(1000, 2000, 90)/10000.)\r\n\r\n        # Lock file creation\r\n        lock_file = get_conf_path('spyder.lock')\r\n        lock = lockfile.FilesystemLock(lock_file)\r\n\r\n        # Try to lock spyder.lock. If it's *possible* to do it, then\r\n        # there is no previous instance running and we can start a\r\n        # new one. If *not*, then there is an instance already\r\n        # running, which is locking that file\r\n        try:\r\n            lock_created = lock.lock()\r\n        except:\r\n            # If locking fails because of errors in the lockfile\r\n            # module, try to remove a possibly stale spyder.lock.\r\n            # This is reported to solve all problems with\r\n            # lockfile (See issue 2363)\r\n            try:\r\n                if os.name == 'nt':\r\n                    if osp.isdir(lock_file):\r\n                        import shutil\r\n                        shutil.rmtree(lock_file, ignore_errors=True)\r\n                else:\r\n                    if osp.islink(lock_file):\r\n                        os.unlink(lock_file)\r\n            except:\r\n                pass\r\n\r\n            # Then start Spyder as usual and *don't* continue\r\n            # executing this script because it doesn't make\r\n            # sense\r\n            from spyder.app import mainwindow\r\n            mainwindow.main()\r\n            return\r\n\r\n        if lock_created:\r\n            # Start a new instance\r\n            from spyder.app import mainwindow\r\n            mainwindow.main()\r\n        else:\r\n            # Pass args to Spyder or print an informative\r\n            # message\r\n            if args:\r\n                send_args_to_spyder(args)\r\n            else:\r\n                print(\"Spyder is already running. If you want to open a new \\n\"\r\n                      \"instance, please pass to it the --new-instance option\")\r\n    else:\r\n        from spyder.app import mainwindow\r\n        mainwindow.main()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r\n", "path": "spyder/app/start.py"}]}