debrief / pepys-import

Support library for Pepys maritime data analysis environment
https://pepys-import.readthedocs.io/
Apache License 2.0
5 stars 5 forks source link

Crash on export by wargame #1120

Closed IanMayo closed 2 years ago

IanMayo commented 2 years ago

Version

0.0.35

🐞 Description

PepysAdmin crashes on export by wargame

⚙️ Current behavior

I have a SQLite database that contains a Wargame Series, two Wargames, and each one has two serials. One wargame overlaps in time with some loaded track data.

I'm trying to export the wargame that covers the track data, but the admin crashes:

(pepys-admin) (snapshot) 6
Traceback (most recent call last):
  File "/Users/ian/mambaforge/envs/pepys/lib/python3.9/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'AdminShell' object has no attribute 'do_4'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ian/mambaforge/envs/pepys/lib/python3.9/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'SnapshotShell' object has no attribute 'do_6'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ian/mambaforge/envs/pepys/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/ian/mambaforge/envs/pepys/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/ian/git/pepys-import/pepys_admin/cli.py", line 120, in <module>
    main()
  File "/Users/ian/git/pepys-import/pepys_admin/cli.py", line 47, in main
    run_shell(db=args.db, path=args.path, training=args.training, viewer=args.viewer)
  File "/Users/ian/git/pepys-import/pepys_admin/cli.py", line 106, in run_shell
    AdminShell(data_store, path).cmdloop()
  File "/Users/ian/mambaforge/envs/pepys/lib/python3.9/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/Users/ian/mambaforge/envs/pepys/lib/python3.9/cmd.py", line 216, in onecmd
    return self.default(line)
  File "/Users/ian/git/pepys-import/pepys_admin/base_cli.py", line 19, in default
    self.aliases[cmd_]()
  File "/Users/ian/git/pepys-import/pepys_admin/admin_cli.py", line 117, in do_snapshot
    snapshot_shell.cmdloop()
  File "/Users/ian/mambaforge/envs/pepys/lib/python3.9/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/Users/ian/mambaforge/envs/pepys/lib/python3.9/cmd.py", line 216, in onecmd
    return self.default(line)
  File "/Users/ian/git/pepys-import/pepys_admin/base_cli.py", line 19, in default
    self.aliases[cmd_]()
  File "/Users/ian/git/pepys-import/pepys_admin/snapshot_cli.py", line 226, in do_export_all_data_filter_wargame_participation
    selected_wargame_id = _select_wargame(self.data_store)
  File "/Users/ian/git/pepys-import/pepys_admin/snapshot_helpers.py", line 439, in _select_wargame
    selected_wargame_id = wargame_dict[selected_wargame_name]
KeyError: None

It appears that iterfzf is returning a null value immediately, instead of waiting for a selection.

⚙️ Expected behavior

The CLI should prompt me to select a wargame.

🔢 Steps to Reproduce

Steps as described above.

🖥️ Screenshots

screencast

robintw commented 2 years ago

Thanks @IanMayo. Could you attach the SQLite database, so I can test it with that specific wargame.

IanMayo commented 2 years ago

Attached. But, I'm going to see if it's specific to this PC. When I tried to View table, it returned before I could enter a table name. Let me test another machine.

pepys_test.sqlite.zip

Ok, I don't get the issue on MS-Windows. I'm just getting it on Apple Mac Silicon.

robintw commented 2 years ago

That's interesting, as it's all working fine with that database file on my Mac Silicon. I wonder what's going on...

IanMayo commented 2 years ago

New version of SQLite database, including wargame: image

pepys_test.sqlite.zip

robintw commented 2 years ago

I can't reproduce on Mac OS, and Ian can't reproduce on Windows, so closing for now.