why do i am getting unrecognized arguments while parsing with argparse?

by Bunny   Last Updated July 12, 2019 05:15 AM

i am running a blender script where it takes command line arguments which are these

parser = ArgumentParserForBlender()
parser.add_argument('--bvhFile',type=str,help='provide bvh file path',required=True)
parser.add_argument('--mhx2File',type=str,help='provide mhx2 model file path',required=True)
parser.add_argument('--fps',default=15,type=int,help='Please provide frame rate for Animation(default=15)',required=True)
parser.add_argument('--FramesToRetarget',type=int,help="How many frames do you wanna retarget(default=All the frames present in bvh file)")
parser.add_argument('--videoFormat',default='FFMPEG',help='video format in which animation will be generated(default=FFMPEG)',choices=['FFMPEG','AVI_JPEG','AVI_RAW'],required=True)
parser.add_argument('--Animation',default=False,type=lambda x: (str(x).lower() == 'true'),help='True if you want to get animation video(default False)')
parser.add_argument('--Point_tracking',default=False,type=lambda x: (str(x).lower() == 'true'),help='True if you want to get point tracking of vertices(default=False)')
parser.add_argument('--camera_location',default="(0,-3,0)",type=str,help='specify a camera location as in format-(x,y,z),default is (0,-3,0)')

args = parser.parse_args()
bvhFile = args.bvhFile
mhx2File =args.mhx2File
fps = args.fps
EndFrame = args.FramesToRetarget
videoFormat =args.videoFormat
bool_animation = args.Animation
bool_pointtracking = args.Point_tracking
camera_loc = args.camera_location

and i am running this with this code

$ bash run_render.sh --bvhFile "C:/Users/Vikram Jain/Downloads/demo_bvh.bvh" --mhx2File "characters/John.mhx2" --fps 15 --FramesToRetarget 2 --videoFormat FFMPEG --Animation True

the problem is ocurring because i am not giving camera location argument, but i defined it as optional argument then why this problem occurs?

usage: blender.exe [-h] --bvhFile BVHFILE --mhx2File MHX2FILE --fps FPS
               [--FramesToRetarget FRAMESTORETARGET] --videoFormat
               {FFMPEG,AVI_JPEG,AVI_RAW} [--Animation ANIMATION]
               [--Point_tracking POINT_TRACKING]
               [--camera_location CAMERA_LOCATION]
blender.exe: error: unrecognized arguments:

if i provide --camera_location than the error disappears.



Related Questions


Updated July 08, 2015 14:06 PM

Updated June 06, 2015 22:06 PM

Updated June 06, 2015 22:06 PM

Updated June 26, 2015 12:22 PM

Updated February 25, 2016 03:06 AM