You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This looks like the wrong function call. Everything in the cli.py is intended to be called via the command line interface (hence the name). They look like callable python functions, but the @-wrappers actually change how the function call works. What you want is what is inside the function, i.e.:
from omi.dialects import get_dialect
file_path = "in.json"
o = "out.json" # or None for printing
f = "oep-v1.4"
t = "oep-v1.4"
with open(file_path, "r") as infile:
from_dialect = get_dialect(f)()
obj = from_dialect.parse(infile.read())
to_dialect = get_dialect(t)()
s = to_dialect.compile_and_render(obj)
if o:
with open(o, "w") as outfile:
outfile.write(s)
else:
print(s)
Instead of loading the dialects dynamically (get_dialect(f)(), etc.), you can also use the respective dialect directly: from_dialect = to_dialect = OEP_V_1_4_Dialect
I expected OMI to work in Python using
translate()
, I triedbut it outputs
and exits Python.
What's wrong here?
The text was updated successfully, but these errors were encountered: