0

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?

Joe Platano
  • 586
  • 1
  • 14
  • 27
  • duplicate of this? https://stackoverflow.com/q/75714438/11107541 please confirm yes/no. – starball Jul 05 '23 at 04:54
  • yes it seems like, I didn't find this while searching. Well the posted solutions are either not working ( i have downgraded to Werkzeug 2.2.1, someone mention this is fixed in 0.12.1... but current Werkzeug is 2.3.6) I reinstalled netsh winsocket ... nothing suggested works. Since the other questions have an answer, I think this can stay open. – Joe Platano Jul 05 '23 at 14:12

0 Answers0