OpenEnergyPlatform / oemetadata

Repository for the Open Energy Family metadata. Contains metadata templates, examples and schemas. For metadata conversion see https://github.com/OpenEnergyPlatform/omi
https://openenergyplatform.github.io/oemetadata/
MIT License
21 stars 2 forks source link

Improve file imports/reads #19

Closed 4lm closed 1 year ago

4lm commented 4 years ago

@MGlauer,

in our last talk you told me that you would do file imports/reads differently and that I could have a look at omi/dialects/base/parser.py. For me your approach in __unpack_file() doesn't look that different from what I do. Except mine is not a function definition, and I look up the path with os.path.join(os.path.dirname(__file__), which IMO is not a problem, because it should give on every operating system the correct path string for the JSON file which is in the same folder as the concerning python module.

@MGlauer, can you give me more hints, what you meant!

MGlauer commented 4 years ago

Oh, sorry. It seems I was not clear enough. The problem is __file__because its value depends on how you call this library and its behaviour after packaging is rather unpredictable as we had to learn the hard way

Use pkg_resources instead

chrwm commented 3 years ago

Hi, @4lm @MGlauer; I'm not sure I understand the adaptation request correctly. Could one of you suggest a revision? @jh-RLI, if you do, you might as well implement it.