File size: 1,210 Bytes
f80362a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# curriculum.py

from logging_config import logger

# Function to load the curriculum
def load_curriculum(file_path):
    """
    Reads the curriculum text file and returns its content as a string.
    
    Args:
        file_path (str): Path to the text file.
        
    Returns:
        str: Contents of the text file.
    """
    logger.info(f"Attempting to load curriculum from: {file_path}")

    try:
        with open(file_path, 'r', encoding='utf-8') as file:
            content = file.read().strip()
        logger.info(f"Successfully loaded curriculum. Content length: {len(content)} characters.")
        return content
    except FileNotFoundError:
        logger.error(f"The curriculum file '{file_path}' does not exist.")
        return "Curriculum file not found."
    except Exception as e:
        logger.error(f"Error reading the curriculum file: {e}")
        return "An error occurred while loading the curriculum."

# Define loaded curriculum as variable
CURRICULUM_FILE_PATH = './data/curriculum.txt'
logger.info(f"Initializing curriculum loading from path: {CURRICULUM_FILE_PATH}")
CURRICULUM_SUMMARY = load_curriculum(CURRICULUM_FILE_PATH)
logger.info("Curriculum loading complete.")