Skip to content

Commit a2c46cf

Browse files
authored
Small improvements to sai-cli tool (#70)
* Fix sai-cli -h (import yaml when needed) * Simplify smooth.py imports (use run_sai_cli.py instead) * Catch ImportError in sai_cli.py and suggest pip install spectacularAI[full] * Improve error message
1 parent a902d6e commit a2c46cf

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

python/cli/convert/tum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import os
1212
from pathlib import Path
1313
import subprocess
14-
import yaml
1514
from contextlib import contextmanager
1615
import shutil
1716
import tempfile
@@ -86,6 +85,7 @@ def maybe_extract_tar_or_zip(path):
8685
print(f"Warning: Failed to delete temporary directory '{temp_dir}': {e}")
8786

8887
def get_calibration(input_dir, stereo):
88+
import yaml
8989
calibration = { "cameras": [] }
9090

9191
def convert_distortion(model, coeffs):

python/cli/sai_cli.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ def parse_args():
1919
return parser.parse_args()
2020

2121
def main():
22-
args = parse_args()
23-
args.func(args)
22+
try:
23+
args = parse_args()
24+
args.func(args)
25+
except ImportError as e:
26+
print(f"\n[ImportError] {e}")
27+
print("Try installing dependencies with")
28+
print(" pip install spectacularAI[full]\n")
29+
raise
2430

2531
if __name__ == '__main__':
2632
main()

python/cli/smooth.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
Post-process a session and generate a smoothed trajectory with all frames
33
"""
44
import json
5-
6-
try:
7-
from process.process import parse_input_dir, auto_config
8-
except ImportError:
9-
# hacky: The following mechanism allows using this both as a stand-alone
10-
# script and as a subcommand in sai-cli.
11-
from .process.process import parse_input_dir, auto_config
5+
from .process.process import parse_input_dir, auto_config
126

137
def define_args(parser):
148
parser.add_argument("input", help="Path to folder with session to process")

0 commit comments

Comments
 (0)