소스 검색

hide deprecation warning from webview/bottle

Rodja Trappe 2 년 전
부모
커밋
6fc1ef191c
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  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()