I have created a .whl package using python3.9 setup.py bdist_wheel
and also I have checked that all files gets included in this .whl file. Below is the .whl file structure:
MyPackage/
- api/
- workflow
- cfg
- data1.json
- data2.json
- data3.json
- scripts.py
and I am trying to read json files present inside api/workflow/cfg and add it into dictionary, using below function from scripts.py:
def read_cfg(storage_dir="api/workflow/cfg") -> Dict[str, wd]:
wf: Dict[str, wd] = {}
for json_file in Path(storage_dir).glob("*.json"):
with open(json_file) as f:
definition = json.load(f)
wf[definition["name"]] = wd(**definition)
return wf
However, it gives an empty dictionary. What am I doing wrong and what needs to be changed to read the json files using the .whl file?
This runs successfully when I try to run it directly without using the .whl file.