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