OpenEnergyPlatform / omi

Repository for the Open Metadata Integration (OMI). For metadata definition see metadata repo:
https://github.com/OpenEnergyPlatform/metadata
GNU Affero General Public License v3.0
7 stars 4 forks source link

CLI not working(?) #8

Closed christian-rli closed 5 years ago

christian-rli commented 5 years ago

I'm on an Ubuntu machine and not sure whether this is an actual bug or a result of my setup. Installing omi via pip or from source both result in an error, when using the following command in via command line:

omi translate -f oep-v1.3 -t oep-v1.4 metadata_v13.json

I used the sample json from within this repo. My error looks like this:

  File "/home/christianh/anaconda3/bin/omi", line 11, in <module>
    sys.exit(main())
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/omi/cli.py", line 49, in main
    cli()
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/omi/cli.py", line 35, in translate
    obj = from_dialect.parse(infile.read())
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/omi/dialects/base/dialect.py", line 18, in parse
    return p.parse(string, *args, **kwargs)
  File "/home/christianh/anaconda3/lib/python3.7/site-packages/omi/dialects/oep/parser.py", line 59, in parse
    old_spatial = json_old.get("spatial")
AttributeError: 'str' object has no attribute 'get'

I tried fiddling around with different branches and installing omi from there, but to no avail. Since it's mentioned in the documentation, I tried the same conversion with the command metadata-tool as well, which produced the same error.