I'm trying to compile my application with cx_Freeze.
On development machine (with Windows 10) the program is working well. But when i try it on other machine (with Windows 7) I get an error message. Strange that when i try it on another machine with Windows 10 there was no error.
One of the libraries - "pyhidapi" - search hidapi.dll in some strange places.
C:\Users\***\Downloads\build>main
Traceback (most recent call last):
File "C:\Python3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line
14, in run
File "C:\Python3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26,
in run
File "main.py", line 14, in <module>
File "main.py", line 8, in main
File "C:\ntt_flashcopier_source\interface\qt_interface.py", line 39, in __init
__
File "C:\ntt_flashcopier_source\ntt_flash_copier\ntt_flash_copier.py", line 14
, in __init__
File "C:\ntt_flashcopier_source\ntt_flash_copier\device_list\device_list.py",
line 11, in __init__
File "C:\ntt_flashcopier_source\ntt_flash_copier\device_list\device_implemento
r_list.py", line 10, in __init__
File "C:\ntt_flashcopier_source\ntt_flash_copier\device_list\hid_device_finder
.py", line 8, in __init__
File "C:\Python3\lib\site-packages\pyhidapi\pyhidapi.py", line 417, in hid_ini
t
File "C:\Python3\lib\site-packages\pyhidapi\pyhidapi.py", line 162, in __load_
hidapi
RuntimeError: Could not find the hidapi shared library.
There is my setup.py file:
from cx_Freeze import setup, Executable
executables = [
Executable('main.py',
icon='icon.ico')
]
_excludes = []
_include_files = ["hidapi.dll", 'conf.xml']
_includes = []
build_exe_options = {'include_msvcr': True,
'include_files': _include_files,
'includes': _includes,
'excludes': _excludes,
'build_exe': 'build',
}
setup(name='main',
version='0.1',
description='NTT Flash Copier',
options={"build_exe": build_exe_options},
executables=executables,
requires=['pyhidapi', 'psutil', 'PyQt5']
)
I expect this program to run on windows 7 and 10 without additional installations of something like python, etc. Simple saying the portable one.
EDIT 1: Maybe the problem is in the system (Windows 7). I found out that cx_Freeze can't do multi-platform compiling. I will try to compile code in Windows 7 system tomorrow.
EDIT 2: Done previous thing. It still get me the same issue and it don't work on other Windows 10 machine.
EDIT 3: Now I'm trying to set virtualenv for my project. I got the same error. I think there must be the another way to install pyhidapi.
EDIT 4: Tried to install pyhidapi from source. The error is still there. Now I'm rewriting code to implement pywinusb library. Do I need to answer this question or I will left it open, maybe someone answer it?