Skip to content

Commit de65939

Browse files
open url in web browser (#133)
* used webbrowser module instead of subprocess used `webbrowser` module instead of `subprocess` to open URL in the browser * Update flet.py
1 parent 7036369 commit de65939

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

sdk/python/flet/flet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import signal
55
import socket
6+
import subprocess
67
import tarfile
78
import tempfile
89
import threading

sdk/python/flet/utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import platform
3-
import subprocess
43
import sys
4+
import webbrowser
55

66

77
def is_windows():
@@ -47,10 +47,7 @@ def get_arch():
4747

4848

4949
def open_in_browser(url):
50-
if is_windows():
51-
subprocess.run(["explorer.exe", url])
52-
elif is_macos():
53-
subprocess.run(["open", url])
50+
webbrowser.open(url)
5451

5552

5653
# https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python

0 commit comments

Comments
 (0)