From 6cbf9928702973afdec4fb260390a5f3ae2138d4 Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Sun, 21 Apr 2024 14:13:34 -0400 Subject: [PATCH] chore: Remove .csv extension from filename in convert_to_csv.py --- scrapegraphai/utils/convert_to_csv.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scrapegraphai/utils/convert_to_csv.py b/scrapegraphai/utils/convert_to_csv.py index 982ac45e..9b430fff 100644 --- a/scrapegraphai/utils/convert_to_csv.py +++ b/scrapegraphai/utils/convert_to_csv.py @@ -12,12 +12,10 @@ def convert_to_csv(data: dict, filename: str, position: str = None): Args: data (dict): Data to be converted to CSV. - filename (str): Name of the CSV file (without the .csv extension). position (str): Optional path where the file should be saved. If not provided, the directory of the caller script will be used. Raises: - ValueError: If the filename contains '.csv'. FileNotFoundError: If the specified directory does not exist. PermissionError: If the program lacks write permission for the directory. TypeError: If the input data is not a dictionary. @@ -25,7 +23,7 @@ def convert_to_csv(data: dict, filename: str, position: str = None): """ if ".csv" in filename: - raise ValueError("The filename should not contain '.csv'") + filename = filename.replace(".csv", "") # Remove .csv extension # Get the directory of the caller script if position is not provided if position is None: