python-nftables-tutorial icon indicating copy to clipboard operation
python-nftables-tutorial copied to clipboard

Validating json fails with "No module named 'jsonschema'"

Open GlyphSH opened this issue 4 years ago • 1 comments

https://github.com/aborrero/python-nftables-tutorial/blob/main/nft-load-example-ruleset.py#L81

Step 2 throws this error: ERROR: failed validating json schema: No module named 'jsonschema'

pip install jsonschema does not fix this issue.

Running on Ubuntu 20.04 LTS with python3-nftables installed via package manager. Python 3.8.

GlyphSH avatar Jan 02 '22 21:01 GlyphSH

This is likely a problem in libnftables itself. The code does import jsonschema (see http://git.netfilter.org/nftables/tree/py/nftables.py?h=v1.0.2#n31) but that dependency is not declared anywhere in the code. So the pip package likely doesn't include it.

The debian package solves this by explicitly declaring the dependency, see https://salsa.debian.org/pkg-netfilter-team/pkg-nftables/-/blob/debian/1.0.2-1/debian/control#L91

Thanks for the report, I'll forward it to upstream developers.

aborrero avatar Feb 23 '22 13:02 aborrero