VSCode debuging flask app creates Error [WinError 10038] on save/reload

300 Views Asked by At

Since few days I have an issue with reloading when debugging flask apps. Usually, when saving changes the debugger restarts and I could work on my app. Now it still saves and reloads, but throws an error message.

INFO:werkzeug: * Detected change in 'C:\\Users\\joeplatano\\OneDrive\\Projects\\houseMon\\hm-novus\\hmmod\\heaters.py', reloading        
Exception in thread Thread-6 (serve_forever):
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Program Files\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "c:\Users\joeplatano\OneDrive\Projects\houseMon\hm-novus\.venv\Lib\site-packages\werkzeug\serving.py", line 804, in serve_forever

    super().serve_forever(poll_interval=poll_interval)
  File "C:\Program Files\Python311\Lib\socketserver.py", line 233, in serve_forever
    ready = selector.select(poll_interval)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\selectors.py", line 323, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\selectors.py", line 314, in _select
    r, w, x = select.select(r, w, w, timeout)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Sometimes it throws an exception, this open the file C:\Program Files\Python311\Lib\selectors.py and jumps to the line mentioned in the error message above:

    if sys.platform == 'win32':
        def _select(self, r, w, _, timeout=None):
            r, w, x = select.select(r, w, w, timeout)
            return r, w + x, []
    else:
        _select = select.select

On a VM i tried to downgrade Python, Flask and Werkzeug. Each two minor releases, the error still is there. I assume it is in VSCode. Is there a workaround or fix to get debugging/reloading without the error?

0

There are 0 best solutions below