#!/usr/bin/python3 import os from pathlib import Path home = Path.home() # for services file in /lib/systemd/system/ path_for_a_con = home / '.config/wire_py/wg_py' # create dir in home mkdir = home / '.config/wire_py' os.makedirs(mkdir, exist_ok=True) with open(mkdir / 'wg_py', 'w+') as file: if 'true' not in file: file.write('false') file.close()