Python Forum
Syntax Error with Argument Parser
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax Error with Argument Parser
#2
Your parameter list for the extractFrames function is just two string literals. Parameters have to be valid Python tokens, not literal values. You can assign literal values to those tokens as default values for the parameters, so you could do something like this:

def extractFrames(input = 'args.input', output = 'args.output'):
   #directory path, where my video images will be stored
   #Capture vidoe from video file
   cap = cv2.VideoCapture(args["input"])
However, looking at the code, I think what you really want is this:

def extractFrames(args):
   #directory path, where my video images will be stored
   #Capture vidoe from video file
   return cv2.VideoCapture(args["input"])
cap = extractFrames(args)
You might want to check out the function tutorial for details on parameters and return values.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Syntax Error with Argument Parser - by aditya_man - Sep-30-2019, 08:03 AM
RE: Syntax Error with Argument Parser - by ichabod801 - Sep-30-2019, 01:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  World Clock syntax error OscarBoots 1 160 May-03-2024, 05:20 AM
Last Post: snippsat
  Syntax error for "root = Tk()" dlwaddel 15 1,288 Jan-29-2024, 12:07 AM
Last Post: dlwaddel
Photo SYNTAX ERROR Yannko 3 436 Jan-19-2024, 01:20 PM
Last Post: rob101
  Strange argument count error rowan_bradley 3 760 Aug-06-2023, 10:58 AM
Last Post: rowan_bradley
  Syntax error while executing the Python code in Linux DivAsh 8 1,687 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Code is returning the incorrect values. syntax error 007sonic 6 1,269 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  syntax error question - string mgallotti 5 1,366 Feb-03-2023, 05:10 PM
Last Post: mgallotti
  Syntax error? I don't see it KenHorse 4 1,319 Jan-15-2023, 07:49 PM
Last Post: Gribouillis
  Syntax error tibbj001 2 940 Dec-05-2022, 06:38 PM
Last Post: deanhystad
  Python-for-Android:p4a: syntax error in main.py while compiling apk jttolleson 2 1,911 Sep-17-2022, 04:09 AM
Last Post: jttolleson

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020