diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-04-08 12:31:16 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-04-08 12:31:16 +0800 |
| commit | 183ae1e1f0371e8bd3a665b1e31e6a1284ba44e4 (patch) | |
| tree | 6a71ca8f6ad19d2c4355ad992ec32a11bc79fb2b /write.py | |
| parent | 2845da8fcbf4c6024e5c8264aab04c00c5bf26a8 (diff) | |
fixed buggs, added feathersmain
Diffstat (limited to 'write.py')
| -rwxr-xr-x | write.py | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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 |
