ソースを参照

use socket package as fallback

Falko Schindler 1 年間 前
コミット
464746dcb3
1 ファイル変更2 行追加1 行削除
  1. 2 1
      nicegui/welcome.py

+ 2 - 1
nicegui/welcome.py

@@ -1,4 +1,5 @@
 import os
 import os
+import socket
 from typing import List
 from typing import List
 
 
 from .globals import optional_features
 from .globals import optional_features
@@ -12,7 +13,7 @@ except ImportError:
 
 
 def get_all_ips() -> List[str]:
 def get_all_ips() -> List[str]:
     if not 'netifaces' in optional_features:
     if not 'netifaces' in optional_features:
-        return []
+        return [info[4][0] for info in socket.getaddrinfo(socket.gethostname(), None) if len(info[4]) == 2]
     ips = []
     ips = []
     for interface in netifaces.interfaces():
     for interface in netifaces.interfaces():
         try:
         try: