Skip to content

Commit 4fed666

Browse files
authored
Support pathlib.Path for rr.save (#4036)
- Fixes #4024
1 parent 689ac2c commit 4fed666

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

rerun_py/rerun_sdk/rerun/archetypes/asset3d_ext.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
from ..components import MediaType
1111

1212

13-
def guess_media_type(path: str) -> MediaType | None:
14-
from pathlib import Path
15-
13+
def guess_media_type(path: str | pathlib.Path) -> MediaType | None:
1614
from ..components import MediaType
1715

18-
ext = Path(path).suffix.lower()
16+
ext = pathlib.Path(path).suffix.lower()
1917
if ext == ".glb":
2018
return MediaType.GLB
2119
elif ext == ".gltf":

rerun_py/rerun_sdk/rerun/sinks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import logging
4+
import pathlib
45
import socket
56

67
import rerun_bindings as bindings # type: ignore[attr-defined]
@@ -42,7 +43,7 @@ def connect(
4243
_connect = connect # we need this because Python scoping is horrible
4344

4445

45-
def save(path: str, recording: RecordingStream | None = None) -> None:
46+
def save(path: str | pathlib.Path, recording: RecordingStream | None = None) -> None:
4647
"""
4748
Stream all log-data to a file.
4849
@@ -64,7 +65,7 @@ def save(path: str, recording: RecordingStream | None = None) -> None:
6465
return
6566

6667
recording = RecordingStream.to_native(recording)
67-
bindings.save(path=path, recording=recording)
68+
bindings.save(path=str(path), recording=recording)
6869

6970

7071
def disconnect(recording: RecordingStream | None = None) -> None:

0 commit comments

Comments
 (0)