Skip to content

Backward compatibility with latest new features #179

@Antoinehoff

Description

@Antoinehoff

There is backward compatibility issue. As new metadata are expected, one cannot run pgkyl on older .gkyl files anymore here's an example:

pgkyl rt_gk_tcv_nt_iwl_adapt_src_3x2v_p1-ion_0.gkyl info
(default#0)
Traceback (most recent call last):
  File "/global/u1/a/ah1032/.postgkyl_venv/bin/pgkyl", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/global/u1/a/ah1032/.postgkyl_venv/lib64/python3.11/site-packages/click/core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u1/a/ah1032/.postgkyl_venv/lib64/python3.11/site-packages/click/core.py", line 1406, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/global/u1/a/ah1032/.postgkyl_venv/lib64/python3.11/site-packages/click/core.py", line 1904, in invoke
    rv.append(sub_ctx.command.invoke(sub_ctx))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u1/a/ah1032/.postgkyl_venv/lib64/python3.11/site-packages/click/core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u1/a/ah1032/.postgkyl_venv/lib64/python3.11/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u1/a/ah1032/.postgkyl_venv/lib64/python3.11/site-packages/click/decorators.py", line 34, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u1/a/ah1032/postgkyl/src/postgkyl/commands/info.py", line 33, in info
    click.echo(dat.info() + "\n")
               ^^^^^^^^^^
  File "/global/u1/a/ah1032/postgkyl/src/postgkyl/data/gdata.py", line 425, in info
    if self.ctx["geqdsk_sign_convention"] is not None:
       ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'geqdsk_sign_convention'

The file I try to have info on was generated with a very recent, but not the last, version of the main and did not store geqdsk_sign_conventionin metadata. Hence pgkyl cannot find it and is prevented to display the information that are stored.

I think that new key in dictionaries like this should be implemented using a if key in dictionary.keys)() statement before to let the program flows and display its older feature.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions