You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "zzz.py", line 11, in <module>
run_simple('localhost', 4000, application)
File "...\werkzeug\serving.py", line 880, in run_simple
inner()
File "...\werkzeug\serving.py", line 836, in inner
fd=fd)
File "...\werkzeug\serving.py", line 723, in make_server
passthrough_errors, ssl_context, fd=fd)
File "...\werkzeug\serving.py", line 624, in __init__
server_address = get_sockaddr(host, int(port), self.address_family)
File "...\werkzeug\serving.py", line 593, in get_sockaddr
if family == socket.AF_UNIX:
AttributeError: module 'socket' has no attribute 'AF_UNIX'
I hit this today, I kludged in a hack to get going, sharing here.
diff --git a/werkzeug/serving.py b/werkzeug/serving.py
index 6fb43fb7..0561b42e 100644
--- a/werkzeug/serving.py
+++ b/werkzeug/serving.py
@@ -86,6 +86,9 @@ else:
class ForkingMixIn(object):
pass
+if not hasattr(socket, 'AF_UNIX'):
+ socket.AF_UNIX = -99 # FIXME kludge
+
# important: do not use relative imports here or python -m will break
import werkzeug
from werkzeug._internal import _log
@@ -591,7 +594,7 @@ def select_address_family(host, port):
def get_sockaddr(host, port, family):
"""Return a fully qualified socket address that can be passed to
:func:`socket.bind`."""
- if family == socket.AF_UNIX:
+ if hasattr(socket, 'AF_UNIX') and family == socket.AF_UNIX:
return host.split('://', 1)[1]
try:
res = socket.getaddrinfo(
the 2nd patch was my first attempt but there where a bunch of other places where socket.AF_UNIX was used so went with a quick-and-dirty to get my experiment up and running. DO NOT USE the monkey patch! ;)
To reproduce, run the example from the readme:
On Windows, I get the following error:
It seems it was broken in d2140a4#diff-5561c422f09af0c38ec8260f0d17a52dR593
(merged in #1019)
Version info:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Werkzeug 0.15.dev (d2140a4 and later)
The text was updated successfully, but these errors were encountered: