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

XML parser error #207

Closed
Impstar314 opened this issue Oct 29, 2020 · 13 comments
Closed

XML parser error #207

Impstar314 opened this issue Oct 29, 2020 · 13 comments
Labels
bug Something isn't working
Milestone

Comments

@Impstar314
Copy link

Impstar314 commented Oct 29, 2020

setup description:
Matrox Rapixo frame grabber card (dual input not quad).
Adimec TMX74 Coaxpress camera.
installed on computer Matrox MIL 10, SP4, update 87. when checked - the firmwareupdater states that the frame grabber is up to date. Continuous acquisition is possible using Matrox's intellicam app (certain that the camera is fine and works properly)
i'm using the Spyder IDE through anaconda, running on python 3.7.6 (conda base).

problem statement:
Whenever I try to run my code (attached below) I keep getting a RuntimeException from an XmlParser.cpp file. I think it fails reading the ® symbol somewhere. The error:

image

when i go to the relevant place in the XML file i see:
image

I expected from my code to grab and save 10 images from the camera. instead, it saves 10 completely black images.
I can't seem to understand if the problem is somewhere in the harvesters module, the Matrox environment (the .cti file) or something else entirely.
Would greatly appreciate some help. thanks in advance :)
my code:

temp.txt

  • OS: windows 10
  • Python: 3.7.6
  • Harvester: 1.2.8
  • GenTL Producer: Matrox
  • Camera: Adimec tmx74 coaxpress
@divyasaxenaa
Copy link

Did you get any solution? I am facing same kind of issue.
Error while parsing XML stream at line 1 and column 2 : 'not well-formed (invalid token)' : RuntimeException thrown (file 'XmlParser.cpp', line 1720)

@Impstar314
Copy link
Author

Impstar314 commented Feb 13, 2021 via email

@divyasaxenaa
Copy link

I have already installed genicam. I think in my case it’s not reading xml file from one of the zip folder.

@superted6851
Copy link

Describe the bug:

XML parser issue due to "-en" token in XML file. Likely the genicam XML parser needs some error handling for unknown tokens or the XML files need correcting to remove the token. Not sure who the maintainer for the genicam module is as I could not find it on GitHub to post the issue there.

The other thing is the camera seems to use custom tl_type but is connected with a U3V interface, is there away to force the tl_type not sure if it would load different XML files then.

(id_='MQ042MG-CM-TG (37060850)', vendor='XIMEA GmbH.', model='MQ042MG-CM-TG', tl_type='Custom', user_defined_name=None, serial_number='37060850', version='V4.21.20.00')

To Reproduce:
Steps to reproduce the behavior:

_harvester = Harvester()
_harvester.add_file("../../Viserion_NFBP/nfbp/devices/camera/genTL/libXIMEA_GenTL.cti")
_harvester.update()

ia = _harvester.create_image_acquirer(serial_number='37060850')

This is the console output:

image

image

Desktop (please complete the following information):

OS: MacOS 11.1
Python: 3.8
Harvester: 1.2.8
GenTL Producer: Ximea
Camera: MQ042MG-CM-TG

@kazunarikudo
Copy link
Member

I suspect the root cause being discussed here under the topic must be the same as ticket #226. Nothing has been concluded yet but this issue could turn out an issue that needs to be discussed by the GenICam committee. I will try to keep you all up to date. Thanks, Kazunari.

@Impstar314
Copy link
Author

Impstar314 commented Apr 22, 2021 via email

@kazunarikudo
Copy link
Member

kazunarikudo commented May 20, 2021

@superted6851, @divyasaxenaa, and @Impstar314 Hi, probably the latest commit at 5d1e5f0 should fix the issue. I would highly appreciate it if you could try it out when you can. Thank you. Best regards, Kazunari.

@kazunarikudo kazunarikudo added the bug Something isn't working label May 20, 2021
@kazunarikudo kazunarikudo added this to the 1.3.2 milestone May 20, 2021
@superted6851
Copy link

@kazunarikudo I still get the same error but now it returns an image acquirer so I am able to capture one frame but then it throws an error message when I try to close the stream.

OS: MacOS 11.3.1
Python: 3.8
Harvester: 1.3.1.post.dev5
GenTL Producer: Ximea
Camera: MQ042MG-CM-TG

Console Output

image

Test image output

image

@kazunarikudo
Copy link
Member

@superted6851 Thank you for giving it a try. Could you give me the GenTL_Stream.xml file, please? It should be located somewhere under the /var directory. I believe the directory itself is alive until the machine is rebooted. Thanks, Kazunari.

@superted6851
Copy link

@kazunarikudo Here it is
GenTL_Stream.TXT

kazunarikudo added a commit that referenced this issue May 22, 2021
kazunarikudo added a commit that referenced this issue May 22, 2021
kazunarikudo added a commit that referenced this issue May 22, 2021
@kazunarikudo
Copy link
Member

@superted6851 Hi, could you give it a try for the latest commit in the master? I have added a feature to the ImageAcquire class so that you can specify the file name pattern and a sequence of data that is used as the beginning of garbage to be dropped/truncated. For your case, give it the following code if you are sure the linked camera causes the issue discussed here; the file_dict is optional so it is not necessary to pass a dict if you are sure the linked camera or the GenTL Producer does not cause any exception:

ia = h.create_image_acquirer(
    # no change here, use this parameter as you have used before:
    0,
    # pass it a dict consists of a key and a value, a regular expression pattern
    # for a file name to be applied the data truncation and a marker data,
    # respectively:
    file_dict={r'GenTL_Stream\.xml': bytes('-en', encoding='utf-8')})

The ImageAcquire object will drop/truncate the sequence that begins as -en if the file name is GenTL_Stream.xml. Having dropped the garbage data, that you have seen as -en, the XML parser can start to handle a valid XML file at last.

@superted6851
Copy link

@kazunarikudo Still getting the same error seems file_dict is not working as expected.

OS: MacOS 11.3.1
Python: 3.8
Harvester: 1.3.1.post.dev12
GenTL Producer: Ximea
Camera: MQ042MG-CM-TG

image

image

@kazunarikudo
Copy link
Member

@superted6851 Hi. Your case needs to have r'GenTL_.+\.xml' actually. The target seems to have the garbage in other files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants