mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
handle unicode hostnames
https://anki.tenderapp.com/discussions/ankidesktop/41915-something-wrong-and-i-cant-start-anki
This commit is contained in:
parent
f4004ad704
commit
caf95742da
1 changed files with 17 additions and 8 deletions
|
@ -477,14 +477,23 @@ section of the manual, and ensure that location is not read-only.""",
|
||||||
# proxy configured?
|
# proxy configured?
|
||||||
from urllib.request import proxy_bypass, getproxies
|
from urllib.request import proxy_bypass, getproxies
|
||||||
|
|
||||||
if "http" in getproxies():
|
disable_proxies = False
|
||||||
# if it's not set up to bypass localhost, we'll
|
try:
|
||||||
# need to disable proxies in the webviews
|
if "http" in getproxies():
|
||||||
if not proxy_bypass("127.0.0.1"):
|
# if it's not set up to bypass localhost, we'll
|
||||||
print("webview proxy use disabled")
|
# need to disable proxies in the webviews
|
||||||
proxy = QNetworkProxy()
|
if not proxy_bypass("127.0.0.1"):
|
||||||
proxy.setType(QNetworkProxy.NoProxy)
|
disable_proxies = True
|
||||||
QNetworkProxy.setApplicationProxy(proxy)
|
except UnicodeDecodeError:
|
||||||
|
# proxy_bypass can't handle unicode in hostnames; assume we need
|
||||||
|
# to disable proxies
|
||||||
|
disable_proxies = True
|
||||||
|
|
||||||
|
if disable_proxies:
|
||||||
|
print("webview proxy use disabled")
|
||||||
|
proxy = QNetworkProxy()
|
||||||
|
proxy.setType(QNetworkProxy.NoProxy)
|
||||||
|
QNetworkProxy.setApplicationProxy(proxy)
|
||||||
|
|
||||||
# we must have a usable temp dir
|
# we must have a usable temp dir
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue