Skip to content

Commit

Permalink
fix/non_folder_export
Browse files Browse the repository at this point in the history
  • Loading branch information
hynky1999 committed Jan 5, 2024
1 parent 71ce20a commit 2b07e69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lilac/router_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ def serve_dataset_file(filepath: str) -> FileResponse:
def export_dataset(namespace: str, dataset_name: str, options: ExportOptions) -> str:
"""Export the dataset to one of the supported file formats."""
dataset = get_dataset(namespace, dataset_name)
os.makedirs(os.path.dirname(options.filepath), exist_ok=True)
# Only create the directory if the filepath has a directory.
dirname = os.path.dirname(options.filepath)
if dirname:
os.makedirs(dirname, exist_ok=True)

if options.format == 'csv':
dataset.to_csv(
Expand Down

0 comments on commit 2b07e69

Please sign in to comment.