summaryrefslogtreecommitdiff
path: root/write.py
diff options
context:
space:
mode:
Diffstat (limited to 'write.py')
-rwxr-xr-xwrite.py12
1 files changed, 5 insertions, 7 deletions
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