fix(processor): add fallback to absolute imports in queue_handler

This commit is contained in:
pacnpal
2024-11-17 22:03:55 +00:00
parent 86d2eeb13a
commit 13c0cbd9d8

View File

@@ -8,7 +8,9 @@ from typing import Optional, Dict, Any, List, Tuple, Set, TypedDict, ClassVar, C
from datetime import datetime from datetime import datetime
import discord # type: ignore import discord # type: ignore
from .. import utils # Import the utils package try:
# Try relative imports first
from .. import utils
from ..database.video_archive_db import VideoArchiveDB from ..database.video_archive_db import VideoArchiveDB
from ..utils.download_manager import DownloadManager from ..utils.download_manager import DownloadManager
from ..utils.message_manager import MessageManager from ..utils.message_manager import MessageManager
@@ -16,6 +18,16 @@ from ..utils.exceptions import QueueHandlerError
from ..queue.models import QueueItem from ..queue.models import QueueItem
from ..config_manager import ConfigManager from ..config_manager import ConfigManager
from .constants import REACTIONS from .constants import REACTIONS
except ImportError:
# Fall back to absolute imports if relative imports fail
from videoarchiver import utils
from videoarchiver.database.video_archive_db import VideoArchiveDB
from videoarchiver.utils.download_manager import DownloadManager
from videoarchiver.utils.message_manager import MessageManager
from videoarchiver.utils.exceptions import QueueHandlerError
from videoarchiver.queue.models import QueueItem
from videoarchiver.config_manager import ConfigManager
from videoarchiver.processor.constants import REACTIONS
logger = logging.getLogger("VideoArchiver") logger = logging.getLogger("VideoArchiver")