PyAr / pyafipws

Interfases, tools and apps for Argentina's gov't. webservices (soap, com/dll simil-ocx, pdf, dbf, xml, json, etc.) #python
https://github.com/PyAr/pyafipws/wiki/PyAr-PSF-GSoC-2019-Final-Summary
GNU Lesser General Public License v3.0
2 stars 15 forks source link

Internal Database Error in wsfev1.py #70

Open chazuttu opened 3 years ago

chazuttu commented 3 years ago

On execution the command in the main branch:

$ wsfev1 --parametros

the following output is received:

=== Tipos de Paises ===
FEParamGetTiposPaises'}}]}}
Traceback (most recent call last):
  File "C:\Users\pyafipws\py3\Scripts\wsfev1-script.py", line 33, in <module>
    sys.exit(load_entry_point('PyAfipWs===3.9.b-2522-', 'console_scripts', 'wsfev1')())
  File "C:\Users\\pyafipws\py3\lib\site-packages\pyafipws-3.9.b_2522_-py3.9.egg\pyafipws\wsfev1.py", line 1570, in main
    print(u"\n".join(wsfev1.ParamGetTiposPaises()))
  File "C:\Users\pyafipws\py3\lib\site-packages\pyafipws-3.9.b_2522_-py3.9.egg\pyafipws\utils.py", line 201, in capturar_errores_wrapper    
    return func(self, *args, **kwargs)
  File "C:\Users\py3\lib\site-packages\pyafipws-3.9.b_2522_-py3.9.egg\pyafipws\wsfev1.py", line 1228, in ParamGetTiposPaises       
    for p in res["ResultGet"]
KeyError: 'ResultGet'

on checking the return value ret, we find: ret------ {'FEParamGetTiposPaisesResult': {'Errors': [{'Err': {'Code': 501, 'Msg': 'Error interno de base de datos: - Metodo

This seems to be an internal error, causing the failure for Tipos se Paises parameter.

baivab85 commented 7 months ago

I think this code can fix it

def ParamGetTiposPaises(): try: res = some_function_that_returns_dictionary() tipos_paises = res.get("ResultGet", [])
for p in tipos_paises: pass return tipos_paises
except Exception as e: print(f"An error occurred: {e}") return []

foramchudasama commented 1 month ago

I think this code can fix it

def ParamGetTiposPaises(): try: res = some_function_that_returns_dictionary() tipos_paises = res.get("ResultGet", []) for p in tipos_paises: pass return tipos_paises except Exception as e: print(f"An error occurred: {e}") return []