transparencia-mg / age7

https://transparencia-mg.github.io/age7/
1 stars 2 forks source link

`stderr` não é armazenado no target `make datapackage.json` #74

Open fjuniorr opened 2 years ago

fjuniorr commented 2 years ago

O comando dtamg-py etl-make build-datapackage do target make datapackage.json não redireciona stderr com 2>

datapackage.json: datapackage.yaml schemas/* data/* logs/validate/* schemas/dialect.json README.md CHANGELOG.md CONTRIBUTING.md
    dtamg-py etl-make build-datapackage

Como o { ... } > logs/all.txt do all.sh também não faz o redirecionamento de stderr, ele acaba se perdendo.

Percebi isso pelo erro

$ make datapackage.json
2022-03-10T10:36:50-0300 INFO  [dtamg_py.utils] Processando recurso dm_item_desp...
Traceback (most recent call last):
  File "C:\Users\m752587\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\m752587\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\m752587\projects\age7\venv\Scripts\dtamg-py.exe\__main__.py", line 7, in <module>
  File "c:\users\m752587\projects\age7\venv\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\m752587\projects\age7\venv\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "c:\users\m752587\projects\age7\venv\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\m752587\projects\age7\venv\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\m752587\projects\age7\venv\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\m752587\projects\age7\venv\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "c:\users\m752587\projects\age7\venv\lib\site-packages\dtamg_py\build_datapackage.py", line 9, in build_datapackage_cli
    build_datapackage()
  File "c:\users\m752587\projects\age7\venv\lib\site-packages\dtamg_py\utils.py", line 211, in build_datapackage
    validation_log = json.load(json_file)
  File "C:\Users\m752587\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\m752587\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\m752587\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\m752587\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
make: *** [Makefile:9: datapackage.json] Error 1

que somente estava disponível na linha de comando durante e execução e depois se perdeu.

gabrielbdornas commented 1 year ago

Problema permanece e acredito que é fácil de resolver e ajuda no processo de debug.