transparencia-mg / dpckan

MIT License
5 stars 4 forks source link

`dpckan dataset create` error #176

Open gabrielbdornas opened 2 years ago

gabrielbdornas commented 2 years ago

When dataset doesn't have datapackage.json file:

Traceback (most recent call last):
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/frictionless/metadata.py", line 212, in metadata_extract
    with open(descriptor, encoding="utf-8") as file:
FileNotFoundError: [Errno 2] No such file or directory: 'datapackage.json'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/gabrielbdornas/.local/bin/dpckan", line 8, in <module>
    sys.exit(cli())
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/dpckan/create_dataset.py", line 27, in create_cli
    create(ctx.obj['CKAN_HOST'], ctx.obj['CKAN_KEY'], ctx.obj['DATAPACKAGE'], ctx.obj['DATASTORE'])
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/dpckan/create_dataset.py", line 10, in create
    local_datapackage = load_complete_datapackage(datapackage)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/dpckan/functions.py", line 12, in load_complete_datapackage
    datapackage = Package(source)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/frictionless/package.py", line 194, in __init__
    super().__init__(descriptor)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/frictionless/metadata.py", line 45, in __init__
    metadata = self.metadata_extract(descriptor)
  File "/home/gabrielbdornas/.local/lib/python3.8/site-packages/frictionless/metadata.py", line 223, in metadata_extract
    raise FrictionlessException(self.__Error(note=note)) from exception
frictionless.exception.FrictionlessException: [package-error] The data package has an error: cannot extract metadata "datapackage.json" because "[Errno 2] No such file or directory: 'datapackage.json'"