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

Consider merging request-schema.json into a .py file #166

Open
voice-of-texnoforge opened this issue Jun 12, 2021 · 3 comments · Fixed by #284
Open

Consider merging request-schema.json into a .py file #166

voice-of-texnoforge opened this issue Jun 12, 2021 · 3 comments · Fixed by #284

Comments

@voice-of-texnoforge
Copy link
Contributor

Hello,

I've hit a little issue when using jsonrpcserver with PyInstaller:

FileNotFoundError: [Errno 2] No such file or directory: `path-to\\jsonrpcserver\\request-schema.json'

I've submitted a simple hook for PyInstaller which fixes this but I've hit similar issues with python packaging and non-py files many times in the past and I suggest you consider moving the .json data into a .py file unless there's a good reason not to - it can be a new request_schema.py or any of existing files.

This would prevent similar problems with python packaging in various tools without requiring additional effort.

Either way, thanks for the nice library ♥

@bcb
Copy link
Member

bcb commented Jun 13, 2021

Yes, good idea. Can’t see any reason not to do this.

bcb added a commit that referenced this issue Jul 3, 2021
Stop using the global schema in pure functions. Also now properly allows
custom schema validators.

Next step for fixing schema validation is #166
bcb added a commit that referenced this issue Jul 3, 2021
* Fix schema validation

Stop using the global schema in pure functions. Also now properly allows
custom schema validators.

Next step for fixing schema validation is #166

* Remove unused "validate" function
@st31ny
Copy link
Collaborator

st31ny commented Aug 27, 2024

This would also avoid the warning that I get with python 3.12:

.../lib/python3.12/site-packages/jsonrpcserver/__init__.py:19: in <module>
    from .async_main import (
.../lib/python3.12/site-packages/jsonrpcserver/async_main.py:7: in <module>
    from .main import default_validator, default_deserializer
.../lib/python3.12/site-packages/jsonrpcserver/main.py:29: in <module>
    schema = json.loads(importlib.resources.read_text(__package__, "request-schema.json"))
/usr/lib/python3.12/importlib/resources/_legacy.py:25: in wrapper
    return func(*args, **kwargs)
/usr/lib/python3.12/importlib/resources/_legacy.py:79: in read_text
    with open_text(package, resource, encoding, errors) as fp:
/usr/lib/python3.12/importlib/resources/_legacy.py:18: in wrapper
    warnings.warn(
E   DeprecationWarning: open_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.

@bcb
Copy link
Member

bcb commented Aug 28, 2024

Fixed in the version 6

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

Successfully merging a pull request may close this issue.

3 participants