Skip to content

Commit

Permalink
Refactor neon_fallback_skill.py to prevent import errors when `networ…
Browse files Browse the repository at this point in the history
…k` extras aren't installed (#503)

Co-authored-by: Daniel McKnight <[email protected]>
  • Loading branch information
NeonDaniel and NeonDaniel authored Mar 1, 2024
1 parent 0466b78 commit 21e6e4f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions neon_utils/skills/neon_fallback_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import yaml
import json
import os
import pathlib
Expand All @@ -35,10 +37,8 @@
from threading import Event
from typing import List, Any, Optional

import yaml
from dateutil.tz import gettz
from json_database import JsonStorage
from neon_mq_connector.utils.client_utils import send_mq_request
from ovos_bus_client import Message
from ovos_plugin_manager.language import OVOSLangDetectionFactory, OVOSLangTranslationFactory
from ovos_utils.gui import is_gui_connected
Expand Down Expand Up @@ -351,6 +351,12 @@ def send_email(self, title, body, message=None, email_addr=None,
attachments (dict): Optional dict of file names to Base64 encoded files
message (Message): Optional message to get email from
"""
try:
from neon_utils.mq_utils import send_mq_request
except ImportError:
LOG.warning("MQ Dependencies not installed")
send_mq_request = None

message = message or dig_for_message()
if not email_addr and message:
email_addr = get_user_prefs(message)["user"].get("email")
Expand Down

0 comments on commit 21e6e4f

Please sign in to comment.