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

Regression in v0.2.2 #168

Open
j616 opened this issue Feb 23, 2024 · 2 comments
Open

Regression in v0.2.2 #168

j616 opened this issue Feb 23, 2024 · 2 comments

Comments

@j616
Copy link

j616 commented Feb 23, 2024

Hello,
I've getting the following (partial) traceback as of v0.2.2.

    return RAMLLoader().load(input_file)
209
  File "/usr/local/lib/python3.10/site-packages/ramlfications/loader.py", line 123, in load
210
    raml_version, _raml_fragment_type = self._parse_raml_header(raml)
211
  File "/usr/local/lib/python3.10/site-packages/ramlfications/loader.py", line 88, in _parse_raml_header
212
    if not header.startswith(RAMLHEADER):
213
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

Looks to be a strait up type error internal to ramlifications. I can try and create a minimal test case to re-create the issue if required.

@jdiegodcp
Copy link
Owner

Hey James, yes it would be really helpful to check what's the issue

@j616
Copy link
Author

j616 commented Feb 29, 2024

It seems that ramlfications no longer likes file objects opened as bytes type. I'm not sure how this ever worked, given the lack of recent changes, to be honest!

If I have a dummy file:

title: Dummy RAML
version: 0.1
mediaType: application/json

documentation:
  - title: Overview
    content: |
      This is a test of
      the yaml parsing.

And a script as follows:

import ramlfications

with open("test.raml", "rb") as ramlFile:
    ramlfications.parse(ramlFile)

I get the following traceback:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/__init__.py", line 68, in parse
    loader = load(raml)
  File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/__init__.py", line 31, in load
    return load_file(raml_file)
  File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/utils/__init__.py", line 198, in load_file
    return RAMLLoader().load(raml)
  File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/loader.py", line 123, in load
    raml_version, _raml_fragment_type = self._parse_raml_header(raml)
  File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/loader.py", line 88, in _parse_raml_header
    if not header.startswith(RAMLHEADER):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

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

2 participants