diff --git a/openml/datasets/dataset.py b/openml/datasets/dataset.py index fb7605832..8f0e7969d 100644 --- a/openml/datasets/dataset.py +++ b/openml/datasets/dataset.py @@ -109,17 +109,18 @@ def __init__(self, name, description, format=None, paper_url=None, update_comment=None, md5_checksum=None, data_file=None, features=None, qualities=None, dataset=None): - if description and not re.match("^[\x00-\x7F]*$", description): - # not basiclatin (XSD complains) - raise ValueError("Invalid symbols in description: {}".format( - description)) - if citation and not re.match("^[\x00-\x7F]*$", citation): - # not basiclatin (XSD complains) - raise ValueError("Invalid symbols in citation: {}".format( - citation)) - if not re.match("^[a-zA-Z0-9_\\-\\.\\(\\),]+$", name): - # regex given by server in error message - raise ValueError("Invalid symbols in name: {}".format(name)) + if dataset_id is None: + if description and not re.match("^[\x00-\x7F]*$", description): + # not basiclatin (XSD complains) + raise ValueError("Invalid symbols in description: {}".format( + description)) + if citation and not re.match("^[\x00-\x7F]*$", citation): + # not basiclatin (XSD complains) + raise ValueError("Invalid symbols in citation: {}".format( + citation)) + if not re.match("^[a-zA-Z0-9_\\-\\.\\(\\),]+$", name): + # regex given by server in error message + raise ValueError("Invalid symbols in name: {}".format(name)) # TODO add function to check if the name is casual_string128 # Attributes received by querying the RESTful API self.dataset_id = int(dataset_id) if dataset_id is not None else None