From 11ba31de6163c1dbd1da9b6517f38f16e6b89aeb Mon Sep 17 00:00:00 2001 From: Jarian Cottingham Date: Mon, 2 Feb 2026 21:35:54 -0600 Subject: [PATCH] Add detailed database path debugging and file access testing --- factsdb/database.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/factsdb/database.py b/factsdb/database.py index 4d9a6f6..d44c75b 100644 --- a/factsdb/database.py +++ b/factsdb/database.py @@ -21,6 +21,7 @@ class DatabaseManager: self._init_database() except Exception as e: print(f"Warning: Database initialization failed: {e}") + print(f"Database path being used: {self.config.path}") # Create the directory if it doesn't exist and the path has a directory component import os try: @@ -32,8 +33,16 @@ class DatabaseManager: # If no directory, ensure current directory is writable os.makedirs('.', exist_ok=True) print("Verified current directory is writable") + # Try to test if we can create the file + test_path = os.path.abspath(self.config.path) + print(f"Testing database file access at: {test_path}") + # Try to create a simple test file to verify permissions + with open(test_path, 'w') as f: + f.write('') + os.remove(test_path) + print("Database file access test successful") except Exception as dir_error: - print(f"Warning: Could not create database directory: {dir_error}") + print(f"Warning: Could not create database directory or test access: {dir_error}") # Re-raise the original error raise