Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some Exceptions on Windows #177

Merged
merged 1 commit into from
Apr 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion sonota.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,10 @@ def ip4ips():
ret = []
defiface = defaultinterface()
for iface in netifaces.interfaces():
addresses = netifaces.ifaddresses(iface)
try:
addresses = netifaces.ifaddresses(iface)
except ValueError: # You must specify a valid interface name.
continue
if netifaces.AF_INET not in addresses: # python3
continue
for afinet in addresses[netifaces.AF_INET]:
Expand Down Expand Up @@ -644,6 +647,11 @@ def stage2():
log.info("~~ Starting web server (HTTP port: %s, HTTPS port %s)" % (
DEFAULT_PORT_HTTP, DEFAULT_PORT_HTTPS))

# Ensure ProactorEventLoop not used on windows (not yet release in latest tornado)
# https://github.com/python/pyperformance/pull/65/files
if sys.platform == 'win32' and sys.version_info[:2] == (3, 8):
import asyncio
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

if args.legacy:
old = make_app()
Expand Down