Skip to content

Conversation

@huster-wgm
Copy link

@huster-wgm huster-wgm commented Aug 7, 2025

Bug

When you use type=bool with argparse, it doesn't work as expected because any non-empty string (including "False") evaluates to True in Python.

bool("False") == True ✅

Thus,

subprocess.call([
                "./app/python.sh",
                "scripts/replay_implementation.py",
                "--ext-folder", "exts",
                "--enable", "omni.ext.mobility_gen",
                "--enable", "isaacsim.asset.gen.omap",
                "--input_path", recording_path,
                "--output_path", output_path,
                "--render_interval", str(args.render_interval),
                "--render_rt_subframes", str(args.render_rt_subframes),
                "--rgb_enabled", str(args.rgb_enabled),
                "--segmentation_enabled", str(args.segmentation_enabled),
                "--instance_id_segmentation_enabled", str(args.instance_id_segmentation_enabled),
                "--normals_enabled", str(args.normals_enabled),
                "--depth_enabled", str(args.depth_enabled)
            ])

from reply.py and reply_directory.py will always be true.

Solution

Added a str2bool function that properly converts string arguments to boolean values. This function handles various boolean representations like "true", "false", "yes", "no", "1", "0", etc.
Updated all boolean arguments to use type=str2bool instead of type=bool.
Now the script will correctly handle boolean arguments:
--rgb_enabled False will properly set the value to False
--rgb_enabled true will set it to True
--rgb_enabled 0 will set it to False
--rgb_enabled 1 will set it to True
The function also handles edge cases and provides a clear error message if an invalid boolean value is provided. This ensures that your boolean flags work as expected when called from the command line.

@huster-wgm huster-wgm changed the title [BUGFIX] [BUGFIX] in scripts/replay_implementation.py Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant