import json def read_jsonl_file(file_path): """ Reads a .jsonl file and returns a list of Python dictionaries, where each dictionary represents a JSON object from a line in the file. """ data = [] try: with open(file_path, 'r', encoding='utf-8') as f: for line in f: # Strip whitespace and check if the line is not empty stripped_line = line.strip() if stripped_line: try: json_object = json.loads(stripped_line) data.append(json_object) except json.JSONDecodeError as e: print(f"Error decoding JSON on line: {stripped_line}. Error: {e}") except FileNotFoundError: print(f"Error: The file '{file_path}' was not found.") except Exception as e: print(f"An unexpected error occurred: {e}") return data