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

convert.py does not open stream for -of other than xlsx #10

Open
Eszti opened this issue Aug 13, 2021 · 3 comments
Open

convert.py does not open stream for -of other than xlsx #10

Eszti opened this issue Aug 13, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@Eszti
Copy link
Collaborator

Eszti commented Aug 13, 2021

NOTE: this issue was detected on dev

Executing

python brise_plandok/convert.py \
    -i XLSX \
    -if ~/research/data/brise/ann/$1.xlsx \
    -o JSON \
    -of ~/research/data/brise/ann/$1.json

results in

Traceback (most recent call last):
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 391, in <module>
    main()
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 387, in main
    converter.convert(input_stream, output_stream)
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 358, in convert
    self.write(doc, output_stream)
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 348, in write
    self.write_json(doc, stream)
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 324, in write_json
    stream.write(json.dumps(doc))
AttributeError: 'str' object has no attribute 'write'
@Eszti Eszti added the bug Something isn't working label Aug 13, 2021
@Eszti
Copy link
Collaborator Author

Eszti commented Aug 16, 2021

This also applies for inputs.

Executing

python brise_plandok/convert.py \
    -i JSON \
    -if ~/research/data/brise/json/$1.jsonl \ 
    -o XLSX \
    -of ~/research/data/brise/ann/$1.xlsx

results in

Traceback (most recent call last):
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 391, in <module>
    main()
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 387, in main
    converter.convert(input_stream, output_stream)
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 357, in convert
    for doc in self.read(input_stream):
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 313, in read
    yield from self.read_json(stream)
  File "/home/eszter/research/brise-plandok/brise_plandok/convert.py", line 309, in read_json
    yield json.loads(line)
  File "/home/eszter/.pyenv/versions/3.9.6/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/home/eszter/.pyenv/versions/3.9.6/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/eszter/.pyenv/versions/3.9.6/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@recski
Copy link
Owner

recski commented Jun 8, 2022

@Eszti is this still relevant?

@Eszti
Copy link
Collaborator Author

Eszti commented Jun 9, 2022

I think, I did not use functions of this script other than XLSX, so I don't know. But this file should be investigated for deletion, as I mostly used new components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants