python-evtx icon indicating copy to clipboard operation
python-evtx copied to clipboard

Errors while running

Open ghost opened this issue 6 years ago • 4 comments

The following errors occur for the program when I run it. Previously it was running perfectly fine but now it doesn't get corrected. Does anyone have any ideas on how to correct these?

Traceback (most recent call last):
  File "C:\Users\Admin\Desktop\HTC\python-evtx\scripts\evtx_filter_records.py", line 65, in <module>
    main()
  File "C:\Users\Admin\Desktop\HTC\python-evtx\scripts\evtx_filter_records.py", line 56, in main
    for node, err in xml_records(args.evtx):
  File "C:\Users\Admin\Desktop\HTC\python-evtx\scripts\evtx_filter_records.py", line 30, in xml_records
    yield to_lxml(xml), None
  File "C:\Users\Admin\Desktop\HTC\python-evtx\scripts\evtx_filter_records.py", line 15, in to_lxml
    record_xml)
  File "src\lxml\etree.pyx", line 3211, in lxml.etree.fromstring
  File "src\lxml\parser.pxi", line 1872, in lxml.etree._parseMemoryDocument
ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

ghost avatar Feb 13 '19 07:02 ghost

what changed since the last time it was running fine?

williballenthin avatar Feb 13 '19 23:02 williballenthin

nothing actually. I didn't run it for a few days and the next time I did, it shows these errors

ghost avatar Feb 14 '19 05:02 ghost

Hey, anyone else who had this issue? Did it get rectified??

ghost avatar Mar 20 '19 10:03 ghost

Add .encode('utf-8') at line 15 file evtx_filter_records.py after record_xml like so:

    return etree.fromstring("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>%s" %
                         record_xml.encode('utf-8'))

This fixes the error.

IceM4nn avatar Nov 08 '19 06:11 IceM4nn