libigl-python-bindings icon indicating copy to clipboard operation
libigl-python-bindings copied to clipboard

Reading files with pathlib

Open paddyroddy opened this issue 4 years ago • 5 comments

Have to convert to string before reading in image

paddyroddy avatar Mar 11 '21 12:03 paddyroddy

Interesting, I have no idea how to fix this. Seems more of an issue in pybin11 than igl

teseoch avatar Mar 11 '21 20:03 teseoch

in the code I just convert it to a string which works i.e. I pass in str(_meshes_path / f"{mesh_name}.obj") in this example

paddyroddy avatar Mar 11 '21 21:03 paddyroddy

My understanding is that the implicit feature request here is for igl.read* (and igl.write*) functions to accept pathlib paths as input in addition to strings. Sounds like a good request and would be happy to merge a PR if anyone wants to take it on.

alecjacobson avatar Feb 06 '23 00:02 alecjacobson

My understanding is that the implicit feature request here is for igl.read* (and igl.write*) functions to accept pathlib paths as input in addition to strings. Sounds like a good request and would be happy to merge a PR if anyone wants to take it on.

Yep, that's what I was thinking!

paddyroddy avatar Feb 06 '23 11:02 paddyroddy

I think this means that the underlying C++ function in libigl should probably take std::filesystem::path as input.

If I read that page correctly then std::filesystem::path is convertable to string as well. So maybe we could already start with using std::filesystem::path as the input type on the bindings.

alecjacobson avatar Sep 26 '23 00:09 alecjacobson