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

added path for hidapi.dll for windows #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rundekugel
Copy link

I love this lib, but when I distributed my python-usb-hid script, some users can't execute it.

This added paths helped, if the pyhidapi is not installed, but a copy is distributed with the script, and the dll is also only copied in to the folder of script or lib.

This helps, if the pyhidapi is not installed, but a copy is distributed
with the script, and the dll is also only copied.
@apmorton
Copy link
Owner

I would recommend changing the path environment variable to include the absolute path to where you distribute the dll as part of your script before importing the hid library.

I'm a bit hesitant to add relative paths here since that could pose a security risk in a lot of contexts.

@ndreys
Copy link
Contributor

ndreys commented Feb 10, 2024

@rundekugel if you are distributing pyhidapi, you can probably place the .dll next to it and it should work, see https://bugs.python.org/issue43173 However, if I remember correctly, I wasn't able to make this work when using Python installed via MS Store, so there I also had to do:

if sys.platform == 'win32':
    os.add_dll_directory(os.path.dirname(os.path.abspath(__file__)))

all that is to say, I think you can solve your problem without making any changes to this lib.

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

Successfully merging this pull request may close these issues.

3 participants