Running Flask raises "WinError 10038"
Question:
Running a simple Flask app raises OSError: [WinError 10038] An operation was attempted on something that is not a socket
. The page is not served in the browser. What does the error mean? How do I fix it?
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello, World!'
if __name__ == '__main__':
app.run(debug=True)
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger pin code: 294-294-951
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:UserskdalalAppDataLocalContinuumAnaconda3libthreading.py", line 916, in _bootstrap_inner
self.run()
File "C:UserskdalalAppDataLocalContinuumAnaconda3libthreading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:UserskdalalAppDataLocalContinuumAnaconda3libsite-packageswerkzeugserving.py", line 670, in inner
fd=fd)
File "C:UserskdalalAppDataLocalContinuumAnaconda3libsite-packageswerkzeugserving.py", line 564, in make_server
passthrough_errors, ssl_context, fd=fd)
File "C:UserskdalalAppDataLocalContinuumAnaconda3libsite-packageswerkzeugserving.py", line 474, in __init__
socket.SOCK_STREAM)
File "C:UserskdalalAppDataLocalContinuumAnaconda3libsocket.py", line 460, in fromfd
nfd = dup(fd)
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Answers:
Today, September 2022, I am using Werkzeug 2.2.2 and I’m getting exactly the same issue:
OSError: [WinError 10038] An operation was attempted on something that is not a socket
I tried using the environment variables FLASK_DEBUG and/or FLASK_ENVIRONMENT, since this error only appears when I run the Flask app in debug mode, but I keep getting this socket error. I’ve been searching but I can’t seem to find a solution. Really frustrating not being able to use Flask in debug mode…
Running a simple Flask app raises OSError: [WinError 10038] An operation was attempted on something that is not a socket
. The page is not served in the browser. What does the error mean? How do I fix it?
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello, World!'
if __name__ == '__main__':
app.run(debug=True)
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger pin code: 294-294-951
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:UserskdalalAppDataLocalContinuumAnaconda3libthreading.py", line 916, in _bootstrap_inner
self.run()
File "C:UserskdalalAppDataLocalContinuumAnaconda3libthreading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:UserskdalalAppDataLocalContinuumAnaconda3libsite-packageswerkzeugserving.py", line 670, in inner
fd=fd)
File "C:UserskdalalAppDataLocalContinuumAnaconda3libsite-packageswerkzeugserving.py", line 564, in make_server
passthrough_errors, ssl_context, fd=fd)
File "C:UserskdalalAppDataLocalContinuumAnaconda3libsite-packageswerkzeugserving.py", line 474, in __init__
socket.SOCK_STREAM)
File "C:UserskdalalAppDataLocalContinuumAnaconda3libsocket.py", line 460, in fromfd
nfd = dup(fd)
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Today, September 2022, I am using Werkzeug 2.2.2 and I’m getting exactly the same issue:
OSError: [WinError 10038] An operation was attempted on something that is not a socket
I tried using the environment variables FLASK_DEBUG and/or FLASK_ENVIRONMENT, since this error only appears when I run the Flask app in debug mode, but I keep getting this socket error. I’ve been searching but I can’t seem to find a solution. Really frustrating not being able to use Flask in debug mode…