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

JSON files not found on import #2308

Open
ajw-aws opened this issue May 25, 2020 · 3 comments
Open

JSON files not found on import #2308

ajw-aws opened this issue May 25, 2020 · 3 comments

Comments

@ajw-aws
Copy link

ajw-aws commented May 25, 2020

This package seems broken. Steps to reproduce:

$ which python3
/usr/local/bin/python3
$ python3 -m venv ~/.venv/safteydb
$ source ~/.venv/safteydb/bin/activate
$ pip install safety-db
$ python                                                                                                                                                                                                                                                                                                                             
>>> from safety_db import INSECURE, INSECURE_FULL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/cladam/.venv/safteydb/lib/python3.7/site-packages/safety_db/__init__.py", line 13, in <module>
    with open("data/insecure.json") as __f:
FileNotFoundError: [Errno 2] No such file or directory: 'data/insecure.json'
@pawamoy
Copy link

pawamoy commented Nov 18, 2020

I thought the data would be included in the package as well, but it seems they are not.

@bac
Copy link

bac commented Mar 19, 2021

The files are included, they just aren't referenced properly. I installed safety-db into a virtualenv and the files are at:

./venv/lib/python3.6/site-packages/safety_db/insecure_full.json.

The code expects them in a data directly below your current working directory.

@pawamoy
Copy link

pawamoy commented Mar 19, 2021

You're right! Would be nice if safety itself could detect it, or have an option to enable detection.

efokschaner added a commit to efokschaner/safety-db that referenced this issue Feb 4, 2022
This is a updated fix for pyupio#2308
and supersedes pyupio#2309

It uses importlib.resources which means dropping
support for python 3.6 and below
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

3 participants