diff --git a/Code/recommenderapp/app.py b/Code/recommenderapp/app.py index b1ee67ef9..1d90c2b9b 100644 --- a/Code/recommenderapp/app.py +++ b/Code/recommenderapp/app.py @@ -2,16 +2,16 @@ Module for routing all calls from the frontend """ -import sys -sys.path.append("../../") -from Code.prediction_scripts.item_based import recommend_for_new_user - import json +import sys from search import Search from flask import Flask, jsonify, render_template, request from flask_cors import CORS from utils import send_email_to_user, beautify_feedback_data +sys.path.append("../../") +from Code.prediction_scripts.item_based import recommend_for_new_user + app = Flask(__name__) app.secret_key = "secret key" diff --git a/Code/recommenderapp/utils.py b/Code/recommenderapp/utils.py index a5b789c4c..83c04eb3e 100644 --- a/Code/recommenderapp/utils.py +++ b/Code/recommenderapp/utils.py @@ -2,6 +2,7 @@ import logging import smtplib +from smtplib import SMTPException from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart @@ -76,9 +77,5 @@ def send_email_to_user(recipient_email, categorized_data): # Handle SMTP-related exceptions logging.error("SMTP error while sending email: %s", str(e)) - except Exception as e: - # Handle other exceptions - logging.error("An unexpected error occurred while sending email: %s", str(e)) - finally: server.quit() diff --git a/test/test_search.py b/test/test_search.py index 56c945904..5ec2213ce 100644 --- a/test/test_search.py +++ b/test/test_search.py @@ -3,11 +3,10 @@ """ import sys -sys.path.append("../") -from Code.recommenderapp.search import Search - import unittest import warnings +sys.path.append("../") +from Code.recommenderapp.search import Search warnings.filterwarnings("ignore") diff --git a/test/tests.py b/test/tests.py index 05e15a3a3..7b022d651 100644 --- a/test/tests.py +++ b/test/tests.py @@ -3,11 +3,11 @@ """ import sys +import unittest +import warnings sys.path.append("../") from Code.prediction_scripts.item_based import recommend_for_new_user -import unittest -import warnings warnings.filterwarnings("ignore")