-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_db_import.py
More file actions
38 lines (30 loc) · 1.06 KB
/
debug_db_import.py
File metadata and controls
38 lines (30 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# debug_db_import.py
import sys
import importlib
import traceback
def debug_db_import():
print("Starting DB Import Debug")
# Ensure the project root is in Python path
sys.path.insert(0, '/home/procesor/oauth_service')
print("\nPython Path:")
for path in sys.path:
print(f" {path}")
print("\nAttempting to import oauth_service.core.db")
try:
# Use importlib for more controlled import
import oauth_service.core.db as db_module
print("\nModule Import Details:")
print(f"Module: {db_module}")
print(f"Module File: {db_module.__file__}")
# Demonstrate database usage
print("\nTesting Database Access:")
db_instance = db_module.get_db()
print("Database instance retrieved successfully")
except ImportError as e:
print("Import Error:")
print(traceback.format_exc())
except Exception as e:
print("Unexpected Error:")
print(traceback.format_exc())
if __name__ == "__main__":
debug_db_import()