[Tutor] Argparse Error

Alan Gauld alan.gauld at yahoo.co.uk
Sun Aug 12 03:45:57 EDT 2018


On 12/08/18 00:51, Nathan Johnson wrote:

> Hello I am trying to glitch video files for artistic purposes by using a
> scrip I found on Reddit (linked below). This is the first time I have tried
> to use Python and I need some help with an error that I keep getting after
> I input this first part of the script

The error is not with the Python code but with the way you are
running the script.

> the error says
> 
> : error: the following arguments are required: file

It is telling you that you need to provide a file argument.
Something like:

C:\WINDOWS\PROMPT> python D:\Python\myscript.py D:\Image\myfile.img

That's what all the argparse stuff is there for, to ensure
that Python can read and understand the arguments that
are passed when you run the script.

The script as it stands does nothing except check the arguments.
It does nothing with those arguments.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list