A community-maintained Python framework for creating mathematical animations.
extract_scene now behaves more as expected when passed explicit output file names already containing an extension
Sridhar Ramesh551501b69e6e
diff --git a/extract_scene.py b/extract_scene.pyindex 605b45130..82e7a250c 100644--- a/extract_scene.py+++ b/extract_scene.py@@ -70,6 +70,17 @@ def get_configuration():parser.add_argument("-o", "--output_name")parser.add_argument("-n", "--start_at_animation_number")args = parser.parse_args()+ if args.output_name != None:+ output_name_root, output_name_ext = os.path.splitext(args.output_name)+ expected_ext = '.png' if args.show_last_frame else '.mp4'+ if not output_name_ext in ['', expected_ext]+ print "WARNING: The output will be to (doubly-dotted) %s%s"%output_name_root%expected_ext+ output_name = args.output_name+ else:+ # If anyone wants .mp4.mp4 and is surprised to only get .mp4, or such... Well, too bad.+ output_name = output_name_root+ else:+ output_name = args.output_nameexcept argparse.ArgumentError as err:print(str(err))sys.exit(2)@@ -87,7 +98,7 @@ def get_configuration():"quiet" : args.quiet or args.write_all,"ignore_waits" : args.preview,"write_all" : args.write_all,- "output_name" : args.output_name,+ "output_name" : output_name,"start_at_animation_number" : args.start_at_animation_number,"end_at_animation_number" : None,}