Skip to content

Commit 11140e8

Browse files
authored
Merge pull request #75 from arsaboo/csv
Remove .csv extension from filename in convert_to_csv.py
2 parents 9d795f1 + 6cbf992 commit 11140e8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

scrapegraphai/utils/convert_to_csv.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ def convert_to_csv(data: dict, filename: str, position: str = None):
1212
1313
Args:
1414
data (dict): Data to be converted to CSV.
15-
filename (str): Name of the CSV file (without the .csv extension).
1615
position (str): Optional path where the file should be saved. If not provided,
1716
the directory of the caller script will be used.
1817
1918
Raises:
20-
ValueError: If the filename contains '.csv'.
2119
FileNotFoundError: If the specified directory does not exist.
2220
PermissionError: If the program lacks write permission for the directory.
2321
TypeError: If the input data is not a dictionary.
2422
Exception: For other potential errors during DataFrame creation or CSV saving.
2523
"""
2624

2725
if ".csv" in filename:
28-
raise ValueError("The filename should not contain '.csv'")
26+
filename = filename.replace(".csv", "") # Remove .csv extension
2927

3028
# Get the directory of the caller script if position is not provided
3129
if position is None:

0 commit comments

Comments
 (0)