splor-mg / dpm

https://splor-mg.github.io/dpm/
0 stars 0 forks source link

Bug de backslash do Frictionless no Windows: FrictionlessException: [schema-error] Schema is not valid: cannot retrieve metadata #1

Closed labanca closed 1 month ago

labanca commented 1 year ago
from frictionless import Package
from urllib.parse import urlparse
import validators

url = 'https://raw.githubusercontent.com/transparencia-mg/datapackage-reprex/foreign-key-constraint/datapackage.json'

print(url)
Package(url)

Error:

FrictionlessException: [schema-error] Schema is not valid: cannot retrieve metadata "https://raw.githubusercontent.com/transparencia-mg/datapackage-reprex/foreign-key-constraint\schema/estados.json" because "404 Client Error: Not Found for url: [https://raw.githubusercontent.com/transparencia-mg/datapackage-reprex/foreign-key-constraint%5Cschema/estados.json"](https://raw.githubusercontent.com/transparencia-mg/datapackage-reprex/foreign-key-constraint%5Cschema/estados.json%22)

Issue reportando possível bug aberto no github do Frictionless: https://github.com/frictionlessdata/framework/issues/1505

labanca commented 1 month ago

O bug foi corrigido:

$ python
Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun  6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from frictionless import Package
>>> from urllib.parse import urlparse
>>> import validators
>>>
>>> url = 'https://raw.githubusercontent.com/transparencia-mg/datapackage-reprex/foreign-key-constraint/datapackage.json'
>>>
>>> print(url)
https://raw.githubusercontent.com/transparencia-mg/datapackage-reprex/foreign-key-constraint/datapackage.json
>>> Package(url)
{'name': 'datapackage-reprex',
 'title': 'Data packages for Reproducible Examples',
 'description': 'Esse repositório armazena exemplos de [data '
                'packages](https://specs.frictionlessdata.io/) para construção '
                'de [minimal, reproducible examples '
                '(reprex)](https://stackoverflow.com/help/minimal-reproducible-example)',
 'homepage': 'https://github.com/dados-mg/datapackage-reprex',
 'profile': 'tabular-data-package',
 'licenses': [{'name': 'CC0-1.0',
               'title': 'CC0 1.0',
               'path': 'https://creativecommons.org/publicdomain/zero/1.0/'}],
 'contributors': [{'title': 'Francisco Alves', 'role': 'author'}],
 'keywords': ['estados', 'brasil', 'federação'],
 'version': '0.0.0.9000',
 'resources': [{'name': 'estados',
                'type': 'table',
                'title': 'Estados brasileiros',
                'description': 'Contém as seguintes informações para os '
                               'estados brasileiros\n'
                               '\n'
                               '- Código\n'
                               '- Nome\n'
                               '- Sigla',
                'profile': 'tabular-data-resource',
                'path': 'data/estados.csv',
                'scheme': 'file',
                'format': 'csv',
                'mediatype': 'text/csv',
                'encoding': 'utf-8',
                'schema': 'schema/estados.json'},
               {'name': 'pib-per-capita',
                'type': 'table',
                'profile': 'tabular-data-resource',
                'path': 'data/pib-per-capita.csv',
                'scheme': 'file',
                'format': 'csv',
                'mediatype': 'text/csv',
                'encoding': 'utf-8',
                'schema': 'schema/pib-per-capita.json'}],
 'owner_org': 'controladoria-geral-do-estado-cge'}