-
Notifications
You must be signed in to change notification settings - Fork 270
Description
Estimados, buenas tardes.
Al intentar emitir una factura ya sea en homologación o producción obtengo el siguente error:
Procesando FAC C 0004 00015069 00015069 CUIT 30698316981 $ 1.00 IVA: $ 0.00
NRO: 15069 Resultado: A CAE: 75146755041579 Obs: b'10245: Error 10245' Err: b'' Reproceso: S
Excepcion: b'write() argument must be str, not bytes'
Conectando a wsdl=https://servicios1.afip.gov.ar/wsfev1/service.asmx?WSDL cache=/usr/local/lib/python3.10/dist-packages/PyAfipWs-3.10.0-py3.10.egg/pyafipws/cache proxy={} cacert=None
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/PyAfipWs-3.10.0-py3.10.egg/pyafipws/rece1.py", line 962, in main
depurar_xml(ws.client, RUTA_XML)
File "/usr/local/lib/python3.10/dist-packages/PyAfipWs-3.10.0-py3.10.egg/pyafipws/rece1.py", line 451, in depurar_xml
f.write(client.xml_response)
TypeError: write() argument must be str, not bytes
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/rece1", line 33, in
sys.exit(load_entry_point('PyAfipWs==3.10.0', 'console_scripts', 'rece1')())
File "/usr/local/lib/python3.10/dist-packages/PyAfipWs-3.10.0-py3.10.egg/pyafipws/rece1.py", line 973, in main
escribir_facturas(
File "/usr/local/lib/python3.10/dist-packages/PyAfipWs-3.10.0-py3.10.egg/pyafipws/rece1.py", line 394, in escribir_facturas
json.dump(facturas, archivo, sort_keys=True, indent=4)
File "/usr/lib/python3.10/json/init.py", line 179, in dump
for chunk in iterable:
File "/usr/lib/python3.10/json/encoder.py", line 429, in _iterencode
yield from _iterencode_list(o, _current_indent_level)
File "/usr/lib/python3.10/json/encoder.py", line 325, in _iterencode_list
yield from chunks
File "/usr/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/lib/python3.10/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/usr/lib/python3.10/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type bytes is not JSON serializable
Lo ejecuto de la siguiente manera:
rece1 rece.ini /xml /json /debug --trace
Modificando la línea 451
de f.write(client.xml_response)
a f.write(client.xml_response.decode('utf-8'))
veo que funciona. No se si es la manera adecuada de resolverlo, pero a alguno puede llegar a servirle.
Saludos