Browse Source

hide deprecation warning from webview/bottle

Rodja Trappe 2 năm trước cách đây
mục cha
commit
6fc1ef191c
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      nicegui/standalone_mode.py

+ 4 - 1
nicegui/standalone_mode.py

@@ -3,9 +3,12 @@ import os
 import signal
 import tempfile
 import time
+import warnings
 from threading import Thread
 
-import webview
+with warnings.catch_warnings():  # webview depends on bottle which uses the deprecated cgi function (see https://github.com/bottlepy/bottle/issues/1403)
+    warnings.filterwarnings("ignore", category=DeprecationWarning)
+    import webview
 
 shutdown = multiprocessing.Event()