optimized remove with open
This commit is contained in:
15
start_wg.py
15
start_wg.py
@ -7,12 +7,9 @@ from subprocess import check_call
|
||||
|
||||
path_to_file = Path(Path.home() / ".config/wire_py/settings")
|
||||
|
||||
with open(path_to_file, "r", encoding="utf-8") as a_con:
|
||||
|
||||
# This function is for the independent autostarted of the previously selected tunnel
|
||||
lines = a_con.readlines()
|
||||
a_con = lines[7].strip()
|
||||
if a_con != "off":
|
||||
check_call(["nmcli", "connection", "up", a_con])
|
||||
else:
|
||||
pass
|
||||
a_con = Path(path_to_file).read_text(encoding="utf-8").splitlines(keepends=True)
|
||||
a_con = a_con[7].strip()
|
||||
if a_con != "off":
|
||||
check_call(["nmcli", "connection", "up", a_con])
|
||||
else:
|
||||
pass
|
||||
|
Reference in New Issue
Block a user