Skip to content

Error on windows usage #49

@mustafasoylu

Description

@mustafasoylu

When I use codemetapy on Windows, the below error has occured.

file://C:\Users\MUSTAF~1\AppData\Local\Temp\codemeta.jsonld does not look like a valid URI, trying to serialize this will break.
file://C:\Users\MUSTAF~1\AppData\Local\Temp\schemaorgcontext.jsonld does not look like a valid URI, trying to serialize this will break.
file://C:\Users\MUSTAF~1\AppData\Local\Temp\stype.jsonld does not look like a valid URI, trying to serialize this will break.
file://C:\Users\MUSTAF~1\AppData\Local\Temp\iodata.jsonld does not look like a valid URI, trying to serialize this will break.
file://C:\Users\MUSTAF~1\AppData\Local\Temp\repostatus.jsonld does not look like a valid URI, trying to serialize this will break.

I checked where the error occurs and it looks like when creating file path, you add 'file://' to the string, such as below.

SCHEMA_LOCAL_SOURCE = "file://" + os.path.join(TMPDIR, "schemaorgcontext.jsonld")
CODEMETA_LOCAL_SOURCE = "file://" + os.path.join(TMPDIR, "codemeta.jsonld")
STYPE_LOCAL_SOURCE = "file://" + os.path.join(TMPDIR, "stype.jsonld")
IODATA_LOCAL_SOURCE = "file://" + os.path.join(TMPDIR, "iodata.jsonld")
REPOSTATUS_LOCAL_SOURCE = "file://" + os.path.join(TMPDIR, "repostatus.jsonld")

If you check this issue, I opened in rdflib, you can see rdflib make a string replacement like below.

    if absolute_location.startswith("file:///"):
        filename = url2pathname(absolute_location.replace("file:///", "/"))
        file = open(filename, "rb")
    else:
        input_source = URLInputSource(absolute_location, format)

Since Windows paths does not start with '/', when you only add 'file://' to the beginning, rdflib cannot read the files and the errors I mentioned occurs.

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