Unable to extract CTI from DLL
Added by Maurizio von Flotow almost 3 years ago
I am trying to set up a Python project to communicate with a MityCAM-35MMFHDXS Evaluation Kit using Harvester, as outlined here: https://support.criticallink.com/redmine/projects/gentl_apps/wiki/Using_Python_With_Critical_Link_GenTL_Producer.
I made minimal modifications to the example snap.py (to match my GenTL Viewer directory).
---> Note that the camera has been ordered but has not yet shipped/arrived, so this is all preliminary work. <--
--
Issue
--
When I call the harvester function "add_cti_file" or "add_file" with the 'GenTL Viewer\bin\GenTL.dll', harvester complains with the following error: "GenTL exception: Failed to load CTI file; The specified module could not be found."
--
Attempts to fix:
--
-Add "GenTL Viewer\bin\" directory to PATH
-Download 'sim_camera.xml' and create the corresponding environment variable, as suggested here: https://support.criticallink.com/redmine/projects/gentl_apps/wiki/Running_the_GenTL_producer_in_simulated_mode
--
Questions:
--
Is the .cti file bundled into this GenTL.dll file?
Does a standalone .cti file exist from Critical Link?
Is a camera required for this .cti file to be generated by the GenTL.dll file?
-Maurizio
Replies (6)
RE: Unable to extract CTI from DLL - Added by Jonathan Cormier almost 3 years ago
The dll file takes place of a cti file. Can you share what version of the GenTL viewer you are using? And the python version as well as the version of harvesters?
RE: Unable to extract CTI from DLL - Added by Maurizio von Flotow almost 3 years ago
GenTL Viewer: 2.4.5
Python: 3.8.5
Harvester: 1.3.2
RE: Unable to extract CTI from DLL - Added by Jonathan Cormier almost 3 years ago
Found an issue with the snap.py and instructions: The viewer installation path changed from "Gentle Viewer" to "GenTL Viewer" so they needed to be updated. Update instructions on wiki and uploaded an updated snap.py. Also fixed the deprecation warnings as well.
(gentl_37) C:\Users\jcormier\Documents>python snap.py None 2021-12-14 16:51:24,983 - harvesters - INFO - Added c:\Program Files\Critical Link LLC\GenTL Viewer\bin\GenTL.dll to the CTI file list. 2021-12-14 16:51:24,984 - harvesters - INFO - Discarded the device information list. 2021-12-14 16:51:24,992 - harvesters - INFO - Initialized GenTL Producer, c:\Program Files\Critical Link LLC\GenTL Viewer\bin\GenTL.dll. 2021-12-14 16:51:24,994 - harvesters - INFO - Opened System module, criticallink/gentl.dll. 2021-12-14 16:51:24,995 - harvesters - INFO - Opened Interface module, Simulated. 2021-12-14 16:51:25,008 - harvesters - INFO - Opened Interface module, U3V. 2021-12-14 16:51:25,141 - harvesters - INFO - Updated the device information list. Found 0 devices [] No devices found 2021-12-14 16:51:25,145 - harvesters - INFO - Started resetting the Harvester object. 2021-12-14 16:51:25,146 - harvesters - INFO - Removed the all CTI file from the list. 2021-12-14 16:51:25,147 - harvesters - INFO - Discarded the device information list. 2021-12-14 16:51:25,148 - harvesters - INFO - Closed Interface module, Simulated. 2021-12-14 16:51:25,150 - harvesters - INFO - Closed Interface module, U3V. 2021-12-14 16:51:25,151 - harvesters - INFO - Closed System module, criticallink/gentl.dll. 2021-12-14 16:51:25,154 - harvesters - INFO - Closed c:\Program Files\Critical Link LLC\GenTL Viewer\bin\GenTL.dll. 2021-12-14 16:51:25,156 - harvesters - INFO - Completed resetting the Harvester object.
Tried using the sim camera but it looks like it's not going to work with harvesters right now. Seems like harvesters doesn't like the XML path we are returning.
(gentl_37) C:\Users\jcormier\Documents>set SIMCAM_XML_FILE=C:\Users\jcormier\Documents\sim_camera.xml (gentl_37) C:\Users\jcormier\Documents>python snap.py ... 2021-12-14 16:59:15,070 - harvesters - WARNING - Failed to open xml file /C:/Users/jcormier/Documents/sim_camera.xml. : RuntimeException thrown (file 'XmlParser.cpp', line 157) Traceback (most recent call last): File "C:\Users\jcormier\.conda\envs\gentl_37\lib\site-packages\harvesters\core.py", line 2313, in _get_port_connected_node_map node_map.load_xml_from_zip_file(file_path) File "C:\Users\jcormier\.conda\envs\gentl_37\lib\site-packages\genicam\genapi.py", line 2010, in load_xml_from_zip_file return _genapi.NodeMap_load_xml_from_zip_file(self, ZipFileName) _genapi.RuntimeException: File open failed in ParseXmlFile. Filename = '/C:/Users/jcormier/Documents/sim_camera.xml' : RuntimeException thrown (file 'XmlParser.cpp', line 131) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\jcormier\.conda\envs\gentl_37\lib\site-packages\harvesters\core.py", line 2316, in _get_port_connected_node_map node_map.load_xml_from_file(file_path) File "C:\Users\jcormier\.conda\envs\gentl_37\lib\site-packages\genicam\genapi.py", line 2004, in load_xml_from_file return _genapi.NodeMap_load_xml_from_file(self, FileName) _genapi.RuntimeException: Failed to open xml file /C:/Users/jcormier/Documents/sim_camera.xml. : RuntimeException thrown (file 'XmlParser.cpp', line 157) Traceback (most recent call last): File "snap.py", line 41, in <module> ia = h.create_image_acquirer(list_index=0) File "C:\Users\jcormier\.conda\envs\gentl_37\lib\site-packages\harvesters\core.py", line 3383, in create_image_acquirer file_dict=file_dict, do_clean_up=self._do_clean_up File "C:\Users\jcormier\.conda\envs\gentl_37\lib\site-packages\harvesters\core.py", line 1772, in __init__ file_dict=self._file_dict, do_clean_up=self._do_clean_up) File "C:\Users\jcormier\.conda\envs\gentl_37\lib\site-packages\harvesters\core.py", line 2327, in _get_port_connected_node_map self._remove_intermediate_file(file_path) File "C:\Users\jcormier\.conda\envs\gentl_37\lib\site-packages\harvesters\core.py", line 2342, in _remove_intermediate_file os.remove(file_path) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/C:/Users/jcormier/Documents/sim_camera.xml'
RE: Unable to extract CTI from DLL - Added by Maurizio von Flotow almost 3 years ago
It seems as though this issue is linked to using Anaconda's Spyder IDE.
If I run the file from Pycharm or directly from a command line (or in this case: "Anaconda Prompt"), the program complete successfully.
I was able to pick up on the minor instruction typo when originally implementing and did correctly set my path variable. So unfortunately that was not the issue for me.
Thanks for the help.
RE: Unable to extract CTI from DLL - Added by Maurizio von Flotow almost 3 years ago
Final follow up on this issue:
Spyder is fine!
I just needed to restart Spyder to force it to update its environment variables (since I updated the PATH after I had originally opened Spyder).
RE: Unable to extract CTI from DLL - Added by Jonathan Cormier almost 3 years ago
Glad you got it figured out