Skip to content

Not able to push #16

@noszczykmichal

Description

@noszczykmichal

Hi,

about a year ago I was writing with you about not working instance of this api. The same thing happened recentely so I decided to lunch my own instance to not bother you any more. However when working with your repo and specificly with script "rdf_parser.py" I've noticed that it doesn't work good when name of the file can't be converted to the integer. The thing is that when I downloaded fresh PG catalogue I've found out that in main catalogue apart from directories with rdf files there is one named 'test'. On reaching it your script crashed and as it seems ocassionally can ommit some rdf-files. I've prepered some fix on seperate branch but got error about lack of permissions to push so you can either add me to contributors (I guess then I will be able to push my changes) or you can apply them directly if you think they work for you. Changes start from line 133:
"if filename.endswith(".rdf"):
try:
id = int(os.path.basename(path))
input_file = os.path.join(path, filename)
output_file = os.path.join(args.output, f"{id}.json")
Book.convert_to_json(id, input_file, output_file)
print(f"Converted book: {id}")
except ValueError:
print(f"Error: Cannot convert file named '{os.path.basename(path)}' to integer")
continue

if name == 'main':
parser = argparse.ArgumentParser(
description="Convert RDF files to JSON format for faster parsing.")
parser.add_argument("-i",
"--input", help="The input RDF directory.",
default="res/rdf")
parser.add_argument(
"-o", "--output", help="The output JSON directory", default="res/json")
main(parser.parse_args())" I'm not an python expert so pardon me if I mixed up something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions