Python & GenTL (XML parser error)
Added by Viacheslav Mazlin over 2 years ago
We tried to follow the forum guideline to control GenTL camera with Python (https://support.criticallink.com/redmine/projects/gentl_apps/wiki/Using_Python_With_Critical_Link_GenTL_Producer) and (https://support.criticallink.com/redmine/boards/21/topics/6147?r=6148).
Device and GenTL producer were found without a problem.
Environment variable was created for XML camera file.
However, parsing the XML file throwed a 'syntax' error.
Curiosly the error was thrown on the same place (line 1720) as mentioned about the other GenTL producers (https://github.com/genicam/harvesters/issues/207).
This error was supposed to be fixed in harvesters version 1.3.2 ...
Thank you in advance for any ideas
OS: windows 10
Harvesters: 1.3.2
Python (Anaconda): 3.8.12
GenTL Producer: Critical Link
GenTL Viewer: 2.7.0 (the latest)
Camera: MityCAM-33MMFHDXS
Replies (18)
RE: Python & GenTL (XML parser error) - Added by Jonathan Cormier over 2 years ago
Can you post the criticallink_systemgentl.xml, so we can look at it for syntax errors?
RE: Python & GenTL (XML parser error) - Added by Viacheslav Mazlin over 2 years ago
Yes, here is the generated file
RE: Python & GenTL (XML parser error) - Added by Michael Williamson over 2 years ago
Hello,
Can you disable using the SIMULATED camera option and try again?
I think you need to unset the SIMCAM_XML_FILE environment variable. The Simulated Camera XML file provided by our GenTL producer appears to have a problem with XML validation and is causing the Harvester API to crash.
If you are still having issues, can you also post your python code?
Thanks.
Mike
RE: Python & GenTL (XML parser error) - Added by Viacheslav Mazlin over 2 years ago
Mike,
We have followed your recommendation and removed the SIMCAM_XML_FILE from the list of environment variables.
As expected the simulated camera did not show up in the device list.
However, the same XML problem persists.
Essentially, we are using the python code from the snap.py example. The only change is the XML file path.
Python code is attached.
RE: Python & GenTL (XML parser error) - Added by Michael Williamson over 2 years ago
Can you dump the error messages again? Is it still seeing the Simulated camera XML? The main 35 MM camera should pass XML validation.
You might try to remove the following file:
C:\Program Files\Critical Link LLC\GenTL Viewer\bin\sim_camera.xml
With regards,
Mike
RE: Python & GenTL (XML parser error) - Added by Viacheslav Mazlin over 2 years ago
Here is the error message (attached).
Simulated camera is not seen while the 35 MM camera was opened. We have also removed the sim_camera.xml file.
There is still syntax error in XML parsing.
error msg.txt (4.36 KB) error msg.txt |
RE: Python & GenTL (XML parser error) - Added by Jonathan Cormier over 2 years ago
Can you upload the 'C:\Users\salhadda\Documents\XMLFOLDER\criticallink_systemgentl.xml' file again now that the simcamera is disabled.
RE: Python & GenTL (XML parser error) - Added by Tim Iskander over 2 years ago
I would also try deleting the XML file and re-running just in case harvester is not checking the XML version
RE: Python & GenTL (XML parser error) - Added by Viacheslav Mazlin over 2 years ago
Here is the new criticallink_systemgentl.xml file.
When debugging we also noticed that the error on line 131 in XmlParser.cpp precedes the error on line 1720 (as we saw before in the command window). We attach the screenshot.
By deleting the XML file do you mean the criticallink_systemgentl.xml or the camera_CANON_35MMFHDXS_u3v.xml ?
We are unsure, how we could delete the first one as it is generated during the code run.
Deleting the second XML removes the camera from the list of available devices.
RE: Python & GenTL (XML parser error) - Added by Jonathan Cormier over 2 years ago
Hmm i thought this was from the simcamera but it doesn't match the sim_camera.xml.
ModelName="SFNC_Camera" VendorName="Critical Link LLC" ToolTip="Reference SFNC camera XML (autogenerated)"
Mike this seems to be autogenerated by GenTL.dll in a couple places. Is this expected? Maybe we are chasing the wrong thing.
RE: Python & GenTL (XML parser error) - Added by Jonathan Cormier over 2 years ago
Also, Viacheslav have you tried running the snap.py script without Spyder, since the issue you linked said they had issues with running with Spyder?
RE: Python & GenTL (XML parser error) - Added by Viacheslav Mazlin over 2 years ago
Yes, Jonathan, we tried both with/without Spyder. The 'error msg.txt' before was copied directly from the anaconda console.
RE: Python & GenTL (XML parser error) - Added by Viacheslav Mazlin about 2 years ago
Jonathan, Michael, Tim do you have any updates on the issue?
We wrote to you again because our trial period for the camera will expire in 10 days...
Thanks in advance for any support!
RE: Python & GenTL (XML parser error) - Added by Jonathan Cormier about 2 years ago
Hi Viacheslav, I was able to reproduce this issue today. I'll let you know what I find.
RE: Python & GenTL (XML parser error) - Added by Jonathan Cormier about 2 years ago
This is from an incompatibility with the July 2022 release of genicam 1.2.0. We will work on supporting this release but in the meantime stick with harvesters==1.3.2 and genicam<1.2.0.
Can you switch to the previous version of harvesters and genicam and let me know if it works?
pip install numpy harvesters==1.3.2 genicam==1.1.0
I've updated the wiki as well.
RE: Python & GenTL (XML parser error) - Added by Viacheslav Mazlin about 2 years ago
Hi Jonathan and Thanks,
We could get the Python image with your suggested configuration!
RE: Python & GenTL (XML parser error) - Added by Jonathan Cormier about 2 years ago
Sorry for the delay. With the release of GenTLViewer 2.7.2, the latest harvesters 1.4.0 and genicam 1.2.0 python packages now work. I've updated the wiki https://support.criticallink.com/redmine/projects/gentl_apps/wiki/Using_Python_With_Critical_Link_GenTL_Producer