vs_code 调试python文件
调试python文件
1、编译器选择:ctrl+shift+p,然后在输入框中输入:pythont:select interpreter.
如果解释器选择不正确,则会出错:发生异常: ValueError
mutable default <class 'xx.PackageHeader'> for field header is not allowed: use default_factory
2、args参数应该怎么输入:
看代码中的参数解析器和自定义的参数格式是怎么样的:
原文: _parser = argparse.ArgumentParser(description="convert lvx2 to bag(for ROS1) script")
_parser.add_argument('--in_file', type=str, help='input lvx2 file', required=True)
_parser.add_argument('--out_file', type=str, help='output rosbag file', required=True)
_parser.add_argument('--pc2_topic', type=str, help='PointCloud2 topic name', default='livox_points')
_parser.add_argument('--pc2_frame_id', type=str, help='PointCloud2 frame name', default='livox_frame')
_args = _parser.parse_args(args)
参照网上的配置,去掉了”--“,"args":["in_file=./Indoor_sampledata.lvx2" ,"out_file=./Indoor_sampledata1.bag" ,"pc2_topic=livox_points" ,"pc2_frame_id= livox_frame" ]报错:error: the following arguments are required: --in_file, --out_file
==》根据实际情况调整。