From 274235231e28c8c46c53692e6eb79fc652a75e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vyo=20Henrique?= Date: Wed, 22 May 2019 13:57:58 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20para=20emiss=C3=A3o=20esta?= =?UTF-8?q?do=20de=20GO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O retorno do estado de GO vem com a tag header, com isso, ao tentar ler o status do lote não dava certo pois tentava realizar a leitura em um indice que não existe. --- pynfe/processamento/comunicacao.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pynfe/processamento/comunicacao.py b/pynfe/processamento/comunicacao.py index 0cfdeb2..5b915ea 100644 --- a/pynfe/processamento/comunicacao.py +++ b/pynfe/processamento/comunicacao.py @@ -82,7 +82,12 @@ class ComunicacaoSefaz(Comunicacao): if ind_sinc == 1: try: # Protocolo com envio OK - inf_prot = prot[0][0] # root protNFe + try: + inf_prot = prot[0][0] # root protNFe + except IndexError: + # Estados como GO vem com a tag header + inf_prot = prot[1][0] + lote_status = inf_prot.xpath("ns:retEnviNFe/ns:cStat", namespaces=ns)[0].text # Lote processado if lote_status == '104':