Closed hellokenlee closed 1 year ago
Hi! Thanks for the question!
I don't really know your use case, but I think this issue should not be addressed in a stubgen. If you cannot import the library, you can't inspect it and generate the stubs. It's the library author's responsibility to make it importable. How the regular users of the library are supposed to use it? Do they have to alter the dll path too? That just doesn't sound right.
As a workaround, you can stop using pybind11-stubgen
as a utility and write around the main()
function with the calls of your choice.
Thansk for answering. I am using the workaround you proposed: using pybind11_stubgen as a lib and call main() manualy, that works fine for me. Thank you agian 🍡
Accroding to https://docs.python.org/3/library/os.html#os.add_dll_directory and https://docs.python.org/3.8/whatsnew/3.8.html#bpo-36085-whatsnew: The PATH variable is no longer used after Python3.8.
If the pyd generate by pybind11 has external dependent dynamic library, the
pybind11-stubgen
cannot work correctly:And there is no way to solve this. ( In Python3.7 we can simply modify %PATH% environment variable before we call
pybin11-stubgen
. ) Maybe we can consider adding a commandline argument to let user specify the external dll paths.