Write a Python function that reads a CSV file and calculates the average value of a specified column. The function should handle potential errors gracefully, such as missing files or invalid data types in the specified column.
file_path (string): The path to the CSV file.column_name (string): The name of the column to calculate the average from.None.Example 1:
file_path = 'data.csv'
column_name = 'age'
average_age = calculate_average(file_path, column_name)
Expected Output: 25.5
Example 2:
file_path = 'data.csv'
column_name = 'salary'
average_salary = calculate_average(file_path, column_name)
Expected Output: None (if all entries are invalid or missing)