Repository navigation
'_io.BufferedReader' object has no attribute 'decode' #209
Description
Activity
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'work with an old version:
python3 -m pip install openapi-spec-validator==0.4.0 jsonschema-spec==0.1.4Hi @spaceone ,
I can;t reproduce it. Can you prepare minimal example to reproduce the issue?
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_validationOur workaround is:
https://github.com/univention/univention-corporate-server/blob/87d92592015822ef25b3d052a6b7206295d0e462/test/ucs-test/tests/73_udm-rest/01_openapi_validationThe content of
openapi.jsonis irrelevant, as that file is not yet used.Temporary workaround will be downgrading typing-extensions to version below 4.6:
pip install "typing-extensions<4.6"
Reacted by Florian Bestwonderful, thanks!
Temporary workaround will be downgrading typing-extensions to version below 4.6:
pip install "typing-extensions<4.6"
Unfortuantely this breaks compatibility with
pydanticnow.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/745Edit:
I mixed up the issues on downgradingopenapi-spec-validatorwith the issues on downgradingtyping-extensions. The downgrade related issue regarding the latter is withpydantic. Updated the error message above to fix the same.
I get the error message without an traceback when executing: