You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a pybind11 module which sets up docstrings using the m.doc(...) function call on the module, inside PYBIND11_MODULE. I want to read these docstrings from external files, which are located somewhere relative to the location of the pybind11 module. So I need to know where my module is installed at startup time. I tried m.attr("__file__") but that does not work, presumably because the __file__ attribute only gets set after all .def calls have completed.
So in short: is there any way to get the location at which a pybind11 module is installed at the time the .def functions run, so before the module has been completely registered with python?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a pybind11 module which sets up docstrings using the
m.doc(...)
function call on the module, insidePYBIND11_MODULE
. I want to read these docstrings from external files, which are located somewhere relative to the location of the pybind11 module. So I need to know where my module is installed at startup time. I triedm.attr("__file__")
but that does not work, presumably because the__file__
attribute only gets set after all.def
calls have completed.So in short: is there any way to get the location at which a pybind11 module is installed at the time the
.def
functions run, so before the module has been completely registered with python?Beta Was this translation helpful? Give feedback.
All reactions