0

I'm working on a program that generates table scripts and when I use a table that doesn't have a field, it gives an error. How can I handle this?

I'm using the pandas library

Traceback (most recent call last):
  File "C:\Users\Gabriel Ruiz\Desktop\INOVAÇÃO\ScriptTabelas\index.py", line 167, in <module>
    funcaoSerExecutada()
  File "C:\Users\Gabriel Ruiz\Desktop\INOVAÇÃO\ScriptTabelas\index.py", line 26, in funcaoSerExecutada
    OFERTAS_SM_CLUBE_CLIENTE_MOD019(decimal)
  File "C:\Users\Gabriel Ruiz\Desktop\INOVAÇÃO\ScriptTabelas\index.py", line 122, in OFERTAS_SM_CLUBE_CLIENTE_MOD019
    values = 'element{}.querySelector("{}").value="{}"; element{}.querySelector("{}").value="{}"; element{}.querySelector("{}").value="{}"; element{}.querySelector("{}").value="{}"; element{}.querySelectorAll("{}")[1].value="{}"; element{}.querySelectorAll("{}")[1].value= element{}.querySelectorAll("{}")[1].children[1].value; element{}.querySelector("{}").value="{}";' . format(i, "input[name*='destino_para']", newTable['DESTINOS'][i], i, "input[name*='origem_de']", newTable['ORIGEM'][i], i, "input[name*='preco_de']", newTable['DE'][i], i, "input[name*='preco_por_a_partir_de']", newTable[1][i], i, "input[name*='preco_por_a_partir_de']", newTable['1.1'][i], i, "select[name*='texto_acima_valor']", i, "select[name*='texto_acima_valor']", i, "input[name*='link_do_botao']", newTable['LINKS'][i])
  File "C:\Users\Gabriel Ruiz\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\frame.py", line 3024, in __getitem__
    indexer = self.columns.get_loc(key)
  File "C:\Users\Gabriel Ruiz\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\indexes\base.py", line 3083, in get_loc
    raise KeyError(key) from err
KeyError: 'DE'
Bjorn Ruiz
  • 546
  • 2
  • 4
  • 15

0 Answers0