-
Notifications
You must be signed in to change notification settings - Fork 59
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
Erro: xsdata.exceptions.ParserError: Failed to create target class `` #113
Comments
Penso que o erro está aqui:
se vc tá passando um caminho deveria usar from_path não from_xml. |
Eu troquei para from_path, e o erro continua infelizmente. |
Mesmo erro? será que o caminho do path tá correto mesmo? |
seu eu rodo desta forma funciona: from nfelib.nfe.bindings.v4_0 import NfeProc parser = XmlParser() Me parece que a chamada do from_path não encontra as classes para instanciar |
@ismaelnjr boa, ia te sugerir olhar como está sendo feito nas classes de testes. @rvalyi a documentação no readme tá desatualziado será? |
Estou iniciando em python e estou tendo o seguinte erro que não consegui resolver. Fiz o seguinte código para ler o CNPJ de um xml:
from nfelib.nfe.bindings.v4_0.proc_nfe_v4_00 import NfeProc
nfe_proc = NfeProc.from_xml("etc/xml/35240406313527000152550010000688311001248352-nfe.xml")
print(nfe_proc.NFe.infNFe.emit.CNPJ)
e ao executar estou tendo o seguinte erro:
Traceback (most recent call last):
File "c:\Users\Dell\OneDrive\vs_code\projetos\nfelib-test\nfe-test2.py", line 3, in
nfe_proc = NfeProc.from_xml("nfelib/nfe/samples/v4_0/leiauteNFe/NFe35200159594315000157550010000000012062777161.xml")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\OneDrive\vs_code\projetos\nfelib-test.venv\Lib\site-packages\nfelib_init_.py", line 30, in
from_xml
return XmlParser().from_string(xml)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\OneDrive\vs_code\projetos\nfelib-test.venv\Lib\site-packages\xsdata\formats\dataclass\parsers\mixins.py", line 67, in from_string
return self.from_bytes(source.encode(), clazz, ns_map)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\OneDrive\vs_code\projetos\nfelib-test.venv\Lib\site-packages\xsdata\formats\dataclass\parsers\mixins.py", line 88, in from_bytes
return self.parse(io.BytesIO(source), clazz, ns_map)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\OneDrive\vs_code\projetos\nfelib-test.venv\Lib\site-packages\xsdata\formats\dataclass\parsers\bases.py", line 67, in parse
raise ParserError(f"Failed to create target class
{target_class}
")O que devo fazer para corrigir isso?
The text was updated successfully, but these errors were encountered: