From 183ae1e1f0371e8bd3a665b1e31e6a1284ba44e4 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 8 Apr 2024 12:31:16 +0800 Subject: fixed buggs, added feathers --- write.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'write.py') diff --git a/write.py b/write.py index 748d3d1..19c6439 100755 --- a/write.py +++ b/write.py @@ -5,13 +5,13 @@ from sys import argv from datetime import datetime from configparser import ConfigParser as config from configparser import NoOptionError, NoSectionError -from os import path +from os.path import expanduser, isfile -expanduser = path.expanduser +expanduser = expanduser # function to get config -if not path.isfile(f"{expanduser('~')}/.config/jlog/jlog.conf"): +if not isfile(f"{expanduser('~')}/.config/jlog/jlog.conf"): raise FileNotFoundError(f"Config {expanduser('~')}/.config/jlog/jlog.conf not found") else: printinfo(f"Using config file {expanduser('~')}/.config/jlog/jlog.conf") @@ -23,7 +23,7 @@ except NoSectionError: raise NoSectionError(f"Section global not found in {expanduser('~')}/.config/jlog/jlog.conf") except NoOptionError: log_file = f"{expanduser('~')}/.config/jlog/jlog_{datetime.now()}" -if not path.isfile(log_file): +if not isfile(log_file): printerror(f"Log file {log_file} not found") printwarning(f"Creating new log file {log_file}") open(log_file, 'x').close() @@ -61,9 +61,7 @@ if not skip_ask: try: if askinput("continue? (y/n)").lower() != 'y': printwarning("Reseting...") - from os import execv - from sys import executable - execv(executable, [executable] + argv) + except AttributeError: printwarning("Reseting...") from os import execv -- cgit v1.2.3