I have the following Python package structure
MyPackage/
- assets/
- __init__.py
- asset.py
- file1.json
- file2.json
setup.py
I already included the JSON files in the package by defining it in the setup.py
The asset.py
is the following code:
def get_json_asset(file_name: str) -> dict:
try:
with open(file_name) as f:
return json.loads(f.read())
except Exception as e:
raise e
When I try to use the get_json_asset
in my Python code, I get the error
No such file or directory: 'vulnerability_template.json'