Skip to content

Commit dbf607a

Browse files
committed
[examples] find correct project root
1 parent 3906b2a commit dbf607a

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

examples/graph_of_convex_sets.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,15 @@ This minimal example demonstrates a concept that can be applied to the entire be
100100

101101
```{code-cell} ipython2
102102
import os
103+
from pathlib import Path
103104
from semantic_world.adapters.urdf import URDFParser
104-
print(os.getcwd())
105-
apartment = os.path.realpath(os.path.join(os.getcwd(), 'resources', 'urdf', 'kitchen.urdf'))
105+
root = next(
106+
parent
107+
for parent in [Path.cwd(), *Path.cwd().parents]
108+
if (parent / "pyproject.toml").exists()
109+
)
110+
111+
apartment = os.path.realpath(os.path.join(root, "resources", "urdf", "kitchen.urdf"))
106112
107113
apartment_parser = URDFParser(apartment)
108114
world = apartment_parser.parse()

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ random_events
1919
plotly
2020
rtree
2121
daqp
22+
pathlib

0 commit comments

Comments
 (0)