Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pathlib support to IO methods in Python #6344

Closed
3 tasks done
evbernardes opened this issue Sep 4, 2023 · 2 comments · Fixed by #6619
Closed
3 tasks done

Add pathlib support to IO methods in Python #6344

evbernardes opened this issue Sep 4, 2023 · 2 comments · Fixed by #6619

Comments

@evbernardes
Copy link

evbernardes commented Sep 4, 2023

Checklist

Proposed new feature or change

According to my tests with Open3D 0.17 with Python 3.10, this is not yet implemented.

It would be nice if the reading/writing methods in Open3D supported pathlib as inputs, since this is the preferred way of dealing with system paths for many people. This way, instead of having to transform the path to a string:

from pathlib import Path
import open3d as o3d
path = Path('./Data/CAD/example.stl')
mesh = o3d.io.read_triangle_mesh(path.as_posix())

Or equivalently:

mesh = o3d.io.read_triangle_mesh(str(path))

We could just directly enter the Path object:

from pathlib import Path
import open3d as o3d
path = Path('./Data/CAD/example.stl')
mesh = o3d.io.read_triangle_mesh(path)

This is, of course, very minor and would just add a little convenience to the code. But this would also be pretty straightforward to implement, which is why I think it is worth it.

@ssheorey
Copy link
Member

ssheorey commented Sep 5, 2023

Definitely a good convenience feature and we would welcome community PRs for this.

@evbernardes
Copy link
Author

@ssheorey I'm glad you agree! Do you think this is possible given the use of pybind?

I have never used pybind so I'm not sure where to even start coding a PR for this, but maybe someone else will :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants