diff --git a/hvcc/core/hv2ir/types/IR.py b/hvcc/core/hv2ir/types/IR.py index 06169a5..321b7b6 100644 --- a/hvcc/core/hv2ir/types/IR.py +++ b/hvcc/core/hv2ir/types/IR.py @@ -44,7 +44,10 @@ class HeavyIRType(RootModel): if __name__ == "__main__": import json - with open('../../json/heavy.ir.json') as f: + import importlib_resources + + heavy_ir_json = importlib_resources.files('hvcc') / 'core/json/heavy.ir.json' + with open(heavy_ir_json, "r") as f: data = json.load(f) heavy_ir = HeavyIRType(root=data) print(heavy_ir.root.keys()) diff --git a/hvcc/core/hv2ir/types/Lang.py b/hvcc/core/hv2ir/types/Lang.py index 2dd9c29..1e4d92e 100644 --- a/hvcc/core/hv2ir/types/Lang.py +++ b/hvcc/core/hv2ir/types/Lang.py @@ -40,7 +40,10 @@ class HeavyLangType(RootModel): if __name__ == "__main__": import json - with open('../../json/heavy.lang.json') as f: + import importlib_resources + + heavy_lang_json = importlib_resources.files('hvcc') / 'core/json/heavy.lang.json' + with open(heavy_lang_json, "r") as f: data = json.load(f) heavy_lang = HeavyLangType(root=data) print(heavy_lang.root.keys())