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

ascii decoding issue with Py < 3.9 #109

Open
ghost opened this issue Jan 7, 2021 · 3 comments
Open

ascii decoding issue with Py < 3.9 #109

ghost opened this issue Jan 7, 2021 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 7, 2021

For certain CWL files, e.g. tests/cwl/ebi/workflows/cmsearch-multimodel-wf.cwl when the code is installed in Python < 3.9 we obtain the following error:

ERROR:benten.langserver.server:Unexpected error: 'ascii' codec can't decode byte 0xe2 in position 460: ordinal not in range(128)
Traceback (most recent call last):
  File "benten/langserver/server.py", line 65, in run
    self.handle(request)
  File "benten/langserver/server.py", line 95, in handle
    response = to_dict(self._dispatch(client_query))
  File "benten/langserver/server.py", line 145, in _dispatch
    return f(client_query)
  File "benten/langserver/fileoperation.py", line 56, in serve_textDocument_didOpen
    document = Document(
  File "benten/code/document.py", line 38, in __init__
    self.update(text)
  File "benten/code/document.py", line 57, in update
    self.parse(cwl)
  File "benten/code/document.py", line 89, in parse
    inferred_type.parse(
  File "benten/cwl/recordtype.py", line 167, in parse
    inferred_type.parse(
  File "benten/cwl/lomtype.py", line 104, in parse
    inferred_type.parse(
  File "benten/cwl/recordtype.py", line 167, in parse
    inferred_type.parse(
  File "benten/cwl/linkedfiletype.py", line 38, in parse
    validate_and_load_linked_file(doc_uri, self.prefix, value_range, problems)
  File "benten/cwl/lib.py", line 153, in validate_and_load_linked_file
    contents = linked_file.open("r").read()
  File "/Users/runner/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 460: ordinal not in range(128)
@ghost
Copy link
Author

ghost commented Feb 2, 2021

Use Py 3.9 for server packaging.

@tetron
Copy link
Collaborator

tetron commented Feb 2, 2021

Are you sure the solution isn't for benten/cwl/lib.py to explicitly open the file with UTF-8 encoding?

@tetron
Copy link
Collaborator

tetron commented Feb 2, 2021

FWIW the main reason for the binary packages to use Python 3.8 was that there wasn't a precompiled dukpy module for Python 3.9. Maybe that's changed.

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