fix(core): add fallback to absolute imports in lifecycle.py

This commit is contained in:
pacnpal
2024-11-17 22:14:23 +00:00
parent ba6eb11e81
commit ddaab828fa

View File

@@ -7,14 +7,26 @@ from typing import Optional, Dict, Any, Set, List, Callable, TypedDict, ClassVar
from enum import Enum, auto
from datetime import datetime
from ..core.cleanup import cleanup_resources, force_cleanup_resources
from ..utils.exceptions import (
try:
# Try relative imports first
from .cleanup import cleanup_resources, force_cleanup_resources
from ..utils.exceptions import (
VideoArchiverError,
ErrorContext,
ErrorSeverity,
ComponentError,
CleanupError,
)
)
except ImportError:
# Fall back to absolute imports if relative imports fail
from videoarchiver.core.cleanup import cleanup_resources, force_cleanup_resources
from videoarchiver.utils.exceptions import (
VideoArchiverError,
ErrorContext,
ErrorSeverity,
ComponentError,
CleanupError,
)
logger = logging.getLogger("VideoArchiver")