Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling rdflib.tools.rdfpipe results in AttributeError: 'str' object has no attribute 'decode' #91

Open
Fak3 opened this issue Jun 8, 2020 · 1 comment

Comments

@Fak3
Copy link

Fak3 commented Jun 8, 2020

Hi. I tried to convert from json-ld to turtle with rdflib.tools.rdfpipe and got an error:

> python -m rdflib.tools.rdfpipe -o turtle -i json-ld - <<"EOF"
  {
    "@id": "a",
    "b": [
      {
        "@id": "c"
      }
    ]
  }
EOF

Got an error with traceback:

RDFLib Version: 5.0.0
Traceback (most recent call last):
  File "/usr/lib64/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib64/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/u1/.virtualenvs/nnn/lib/python3.8/site-packages/rdflib/tools/rdfpipe.py", line 188, in <module>
    main()
  File "/home/u1/.virtualenvs/nnn/lib/python3.8/site-packages/rdflib/tools/rdfpipe.py", line 183, in main
    parse_and_serialize(args, opts.input_format, opts.guess,
  File "/home/u1/.virtualenvs/nnn/lib/python3.8/site-packages/rdflib/tools/rdfpipe.py", line 51, in parse_and_serialize
    graph.parse(fpath, format=use_format, **kws)
  File "/home/u1/.virtualenvs/nnn/lib/python3.8/site-packages/rdflib/graph.py", line 1549, in parse
    context.parse(source, publicID=publicID, format=format, **args)
  File "/home/u1/.virtualenvs/nnn/lib/python3.8/site-packages/rdflib/graph.py", line 1078, in parse
    parser.parse(source, self, **args)
  File "/home/u1/.virtualenvs/nnn/lib/python3.8/site-packages/rdflib_jsonld/parser.py", line 83, in parse
    data = source_to_json(source)
  File "/home/u1/.virtualenvs/nnn/lib/python3.8/site-packages/rdflib_jsonld/util.py", line 28, in source_to_json
    return json.load(StringIO(stream.read().decode('utf-8')))
AttributeError: 'str' object has no attribute 'decode'

rdflib==5.0.0
rdflib-jsonld==0.5.0

@Fak3 Fak3 changed the title rdflib.tools.rdfpipe -o turtle -i json-ld results in AttributeError: 'str' object has no attribute 'decode' Calling rdflib.tools.rdfpipe results in AttributeError: 'str' object has no attribute 'decode' Jun 12, 2020
@Fak3
Copy link
Author

Fak3 commented Aug 19, 2020

Maybe related: RDFLib/rdflib#1144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant