akretion / factur-x

Python lib for Factur-X, the e-invoicing standard for France and Germany
Other
189 stars 57 forks source link

Error in generation: lxml.etree.XMLSyntaxError: Start tag expected, '<' not found #17

Open Mark-Wellings opened 4 years ago

Mark-Wellings commented 4 years ago

Hi,

I've been trying to get the 'generate_facturx_from_file' to work. Beforehand I validated my XML file and it's fine. When running the below unfortuntately, no succcess:

from facturx import generate_facturx_from_file
import os
thisdir = os.getcwd()
regular_pdf_invoice = str(thisdir + '\TEST

facturx_xml_file = str(thisdir + '\ZUGFeRD-invoice.xml')
facturx_pdf_invoice = generate_facturx_from_file(regular_pdf_invoice, facturx_xml_file)

The error I get is the following:

Traceback (most recent call last):
File "C:\Users\Mark\Desktop\factur-x.py", line 15, in <module>
facturx_pdf_invoice = generate_facturx_from_file(regular_pdf_invoice, facturx_xml_file)
File "C:\Users\Mark\AppData\Local\Programs\Python\Python37-32\lib\site-packages\facturx        \facturx.py", line 886, in generate_facturx_from_file
xml_root = etree.fromstring(xml_string)
File "src\lxml\etree.pyx", line 3234, in lxml.etree.fromstring
File "src\lxml\parser.pxi", line 1876, in lxml.etree._parseMemoryDocument
File "src\lxml\parser.pxi", line 1757, in lxml.etree._parseDoc
File "src\lxml\parser.pxi", line 1068, in lxml.etree._BaseParser._parseUnicodeDoc
File "src\lxml\parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src\lxml\parser.pxi", line 711, in lxml.etree._handleParseResult
File "src\lxml\parser.pxi", line 640, in lxml.etree._raiseParseError
File "<string>", line 1
lxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1

The files I use are attached (had to attach the xml as txt). TEST.pdf

ZUGFeRD-invoice.txt

schmidtkropp commented 4 years ago

hello everyone, I have the same mistake. facturx-pdfgen tmp_splitpdfout / pdfout-GK24848-0021.pdf ZUGFeRD-invoice.xml zug.pdf works unfortunately it does not work from the script.

hvbtup commented 4 years ago

Seems like a programming error in your code. You'll have to either double the backslash in your literal or use the r'\ZUGFeRD-invoice.xml' form.

rockr79 commented 3 months ago

Hello, I have the same error message, does anyone have a solution yet?

Andy87730 commented 2 weeks ago

I have the same problem...