Skip to content

Commit 46b2c8f

Browse files
Make CLI convert_to_parquet not raise error if no rights to create script branch (#6902)
Do not raise exception if no rights to create script branch
1 parent bb2664c commit 46b2c8f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/datasets/commands/convert_to_parquet.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Optional
44

55
from huggingface_hub import HfApi, create_branch, get_repo_discussions
6+
from huggingface_hub.utils import HfHubHTTPError
67

78
from datasets import get_dataset_config_names, get_dataset_default_config_name, load_dataset
89
from datasets.commands import BaseDatasetsCLICommand
@@ -89,7 +90,10 @@ def run(self) -> None:
8990
time.sleep(5)
9091
delete_files(dataset_id, revision=pr_revision, token=token)
9192
if not revision:
92-
create_branch(dataset_id, branch="script", repo_type="dataset", token=token, exist_ok=True)
93+
try:
94+
create_branch(dataset_id, branch="script", repo_type="dataset", token=token, exist_ok=True)
95+
except HfHubHTTPError:
96+
pass
9397
print(f"You can find your PR to convert the dataset to Parquet at: {pr_url}")
9498

9599

0 commit comments

Comments
 (0)