I am coding a journal where the user can open and create journals. However, when the user enters their desired path, the program is unable to find the path because the entire path is being added to the start of the filename. How do i fix this?
# loading an already existing journal (command o)
def open_journal(args):
global current_profile
if not args:
print("ERROR: No file path provided.")
return
try:
# convert input into path object
file_path = Path(args[0]).resolve()
if not file_path.exists() or file_path.suffix.lower() != ".dsu":
print(f"ERROR: Invalid or missing DSU file at {file_path}.")
return
current_profile = Profile()
try:
current_profile.load_profile(str(file_path))
print(f"Loaded journal: {current_profile.username}")
except Exception as e:
print(f"ERROR: Could not load journal. {e}")
except Exception as e:
print(f"ERROR: Could not process file path. {e}") ```
here is the output: Entering admin mode. Type commands directly.
O C:\Users\user\OneDrive\Desktop\testing1\journal.dsu
ERROR: Invalid or missing DSU file at C:\Users\user\OneDrive\Desktop\testing1\UsersuserOneDriveDesktoptesting1journal.dsu.