Hi, I have created simple program with CVBpy and want to deploy it to other windows computer with PyInstaller. If I try to launch it in Visual Studio Code, it works, if I try to launch when it is compiled with PyInstaller I get{C-API call failed} ({LoadImageFileW})
error when trying to open device.
I am using Anaconda 4.7.11, python 3.6.9, cvb pip version 1.1, cvb version 13.02.002 (64bit)
Here is the code I have tested:
import cvb
if __name__ == '__main__':
print(cvb.install_path() + "/Drivers/GenICam.vin")
discovered_devices_list = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)
print("Found " + str(len(discovered_devices_list)) + "cameras:")
for i in range(len(discovered_devices_list)):
serial = discovered_devices_list[i].read_property(cvb.DiscoveryProperties.DeviceSerialNumber)
status = discovered_devices_list[i].read_property(cvb.DiscoveryProperties.DeviceAccessStatus)
print(str(i) + ":" + str(serial) + " : " + str(status))
camera_port = 0
try:
with cvb.DeviceFactory.open(cvb.install_path() + "/Drivers/GenICam.vin", camera_port) as device:
print("Camera: " + str(camera_port) + " started")
device.close()
print("Camera: " + str(camera_port) + " close")
except Exception as e:
print(e)
Here is pyinstaller build script:
# -*- mode: python -*-
block_cipher = None
import importlib
a = Analysis(['run.py'],
pathex=['D:\\Anaconda\\envs\\cvb3_opencv_test\\Lib\\site-packages',
'D:\\Projektai\\LukstoBrokavimas\\VeneerScanerPythonSource\\CVB_PyInstaller_Test',
'D:\\Anaconda\\envs\\cvb3_opencv_test\\Lib\\site-packages\\cvb'
'C:\\Program Files\\STEMMER IMAGING\\Common Vision Blox'],
binaries=[],
datas=[],
hiddenimports=['cvb'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='run',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=False,
name='run')
Any help and solutions would be appreciated how to use cvb with PyInstaller.