in delete replace open with Path

install fixes
This commit is contained in:
2024-09-15 02:09:43 +02:00
parent d1a822fff0
commit f09e6eed0d
5 changed files with 46 additions and 40 deletions

View File

@ -1,9 +1,12 @@
#!/usr/bin/python3
from subprocess import check_call
from pathlib import Path
path_to_file = '/home/punix/.config/wire_py/wg_py'
path_to_file = Path.home() / '.config/wire_py/wg_py'
if Path.exists(path_to_file):
a_con = Path.read_text(path_to_file)
check_call(['nmcli', 'connection', 'up', a_con])
else:
pass
with open(path_to_file, 'r') as file:
*_, line = file
a_con = line[5:]
check_call(['nmcli', 'connection', 'up', a_con])