Skip to content

Commit

Permalink
Merge pull request #103 from flferretti/patch-1
Browse files Browse the repository at this point in the history
Raise error if a non-existing string-type path is passed
  • Loading branch information
Giulero authored Nov 18, 2024
2 parents a96020d + 53cbe10 commit 1d6666e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/adam/model/std_factories/std_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_xml_string(path: str | pathlib.Path):

# Checking if it is a path or an urdf
if not isPath:
if len(path) <= MAX_PATH and os.path.exists(path):
if len(path) <= MAX_PATH and "<robot" not in path:
path = pathlib.Path(path)
isPath = True
else:
Expand All @@ -49,11 +49,7 @@ def get_xml_string(path: str | pathlib.Path):
break

if isPath:
if not path.is_file():
raise FileExistsError(path)

with path.open() as xml_file:
xml_string = xml_file.read()
xml_string = path.read_text()

if not isPath and not isUrdf:
raise ValueError(
Expand Down

0 comments on commit 1d6666e

Please sign in to comment.