in delete replace open with Path
install fixes
This commit is contained in:
13
start_wg.py
13
start_wg.py
@ -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])
|
||||
|
Reference in New Issue
Block a user