GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — '_io.BufferedReader' object has no attribute 'decode' · Issue #209 · python-openapi/openapi-spec-validator

'_io.BufferedReader' object has no attribute 'decode' #209

New issue
Copy link
New issue
Copy link
Closed
Closed
'_io.BufferedReader' object has no attribute 'decode'#209
Copy link

Description

@spaceone
spaceone
opened on Jun 6, 2023
Issue body actions

I get the error message without an traceback when executing:

# python3 -m openapi_spec_validator openapi.json 
'_io.BufferedReader' object has no attribute 'decode'
# python3 --version
Python 3.7.3
Requirement already satisfied: openapi-spec-validator in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (0.5.6)
Requirement already satisfied: importlib-resources<6.0.0,>=5.8.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (5.12.0)                                                                                
Requirement already satisfied: jsonschema<4.18.0,>=4.0.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (4.17.3)                                                                                        
Requirement already satisfied: jsonschema-spec<0.2.0,>=0.1.1 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (0.1.4)                                                                                     
Requirement already satisfied: lazy-object-proxy<2.0.0,>=1.7.1 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (1.9.0)                                                                                   
Requirement already satisfied: openapi-schema-validator<0.5.0,>=0.4.2 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (0.4.4)                                                                            
Requirement already satisfied: zipp>=3.1.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from importlib-resources<6.0.0,>=5.8.0->openapi-spec-validator) (3.15.0)                                                                   
Requirement already satisfied: attrs>=17.4.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (23.1.0)                                                                         
Requirement already satisfied: importlib-metadata in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (6.6.0)                                                                     
Requirement already satisfied: pkgutil-resolve-name>=1.3.10 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (1.3.10)                                                          
Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (0.19.3)                                         
Requirement already satisfied: typing-extensions in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (4.6.3)                                                                      
Requirement already satisfied: PyYAML>=5.1 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema-spec<0.2.0,>=0.1.1->openapi-spec-validator) (6.0)                                                                          
Requirement already satisfied: pathable<0.5.0,>=0.4.1 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema-spec<0.2.0,>=0.1.1->openapi-spec-validator) (0.4.3)                                                             
Requirement already satisfied: rfc3339-validator in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-schema-validator<0.5.0,>=0.4.2->openapi-spec-validator) (0.1.4)                                                         
Requirement already satisfied: six in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from rfc3339-validator->openapi-schema-validator<0.5.0,>=0.4.2->openapi-spec-validator) (1.16.0) 
Reacted by subnix and Márton Salomváry

Activity

  1. spaceone commented on Jun 6, 2023

    @spaceone
    spaceone
    on Jun 6, 2023
    Author
    More actions

    got the traceback with some debugging:

    Traceback (most recent call last):
      File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/lib/python3.7/site-packages/openapi_spec_validator/__main__.py", line 102, in <module>
        main()
      File "/lib/python3.7/site-packages/openapi_spec_validator/__main__.py", line 73, in main
        spec, spec_url = reader(args_parsed.filename)
      File "/lib/python3.7/site-packages/openapi_spec_validator/readers.py", line 23, in read_from_filename
        return all_urls_handler(uri), uri
      File "/lib/python3.7/site-packages/jsonschema_spec/handlers/file.py", line 45, in __call__
        return self._open(uri)
      File "/lib/python3.7/site-packages/jsonschema_spec/handlers/urllib.py", line 18, in _open
        return super().__call__(fh)
      File "/lib/python3.7/site-packages/jsonschema_spec/handlers/file.py", line 41, in __call__
        parsed_url = urlparse(uri)
      File "/usr/lib/python3.7/urllib/parse.py", line 367, in urlparse
        url, scheme, _coerce_result = _coerce_args(url, scheme)
      File "/usr/lib/python3.7/urllib/parse.py", line 123, in _coerce_args
        return _decode_args(args) + (_encode_result,)
      File "/usr/lib/python3.7/urllib/parse.py", line 107, in _decode_args
        return tuple(x.decode(encoding, errors) if x else '' for x in args)
      File "/usr/lib/python3.7/urllib/parse.py", line 107, in <genexpr>
        return tuple(x.decode(encoding, errors) if x else '' for x in args)
      File "/usr/lib/python3.7/tempfile.py", line 615, in __getattr__
        a = getattr(file, name)
    AttributeError: '_io.BufferedReader' object has no attribute 'decode'
    
    
  2. spaceone commented on Jun 6, 2023

    @spaceone
    spaceone
    on Jun 6, 2023
    Author
    More actions

    work with an old version: python3 -m pip install openapi-spec-validator==0.4.0 jsonschema-spec==0.1.4

  3. p1c2u commented on Jun 10, 2023

    @p1c2u
    p1c2u
    on Jun 10, 2023
    Collaborator
    More actions

    Hi @spaceone ,

    I can;t reproduce it. Can you prepare minimal example to reproduce the issue?

  4. spaceone commented on Jun 10, 2023

    @spaceone
    spaceone
    on Jun 10, 2023
    Author
    More actions

    Hi @spaceone ,

    I can;t reproduce it. Can you prepare minimal example to reproduce the issue?

    The exact code we execute is:
    https://github.com/univention/univention-corporate-server/blob/87d92592015822ef25b3d052a6b7206295d0e462~/test/ucs-test/tests/73_udm-rest/01_openapi_validation

    Our workaround is:
    https://github.com/univention/univention-corporate-server/blob/87d92592015822ef25b3d052a6b7206295d0e462/test/ucs-test/tests/73_udm-rest/01_openapi_validation

    The content of openapi.json is irrelevant, as that file is not yet used.

  5. p1c2u commented on Jun 10, 2023

    @p1c2u
    p1c2u
    on Jun 10, 2023
    Collaborator
    More actions

    p1c2u/jsonschema-path#14

    Temporary workaround will be downgrading typing-extensions to version below 4.6:

    pip install "typing-extensions<4.6"

    Reacted by Florian Best
  6. spaceone commented on Jun 10, 2023

    @spaceone
    spaceone
    on Jun 10, 2023
    Author
    More actions

    wonderful, thanks!

  7. p1c2u
    closed this as completedon Jun 11, 2023
  8. ambadyanands commented on Jun 17, 2024

    @ambadyanands
    ambadyanands
    on Jun 17, 2024
    More actions

    p1c2u/jsonschema-path#14

    Temporary workaround will be downgrading typing-extensions to version below 4.6:

    pip install "typing-extensions<4.6"

    Unfortuantely this breaks compatibility with pydantic now.

    ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
    pydantic-core 2.10.0 requires typing-extensions!=4.7.0,>=4.6.0, but you have typing-extensions 4.5.0 which is incompatible.
    pydantic 2.4.0 requires typing-extensions>=4.6.1, but you have typing-extensions 4.5.0 which is incompatible.
    

    Any idea about what would be a proper solution that will work with latest/recent version of the dependencies?

    Here's the related issue for reference, if it helps:
    https://gitlab.com/gnukhata/gkcore/-/issues/745

    Edit:
    I mixed up the issues on downgrading openapi-spec-validator with the issues on downgrading typing-extensions. The downgrade related issue regarding the latter is with pydantic. Updated the error message above to fix the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.