[Tutor] Argparse Error

Nathan Johnson nathanj9715 at gmail.com
Sun Aug 12 13:59:11 EDT 2018


Here is what comes out when I use the command for each program.

Command Prompt:
C:\Users\natha> C:\WINDOWS\PROMPT> python D:\Python\bytsh.py
D:\Video\test.mp4
'C:\WINDOWS\PROMPT' is not recognized as an internal or external command,
operable program or batch file.

 Python 32x:
>>> C:\WINDOWS\PROMPT> python D:\Python\bytsh.py D:\Video\test.mp4
  File "<stdin>", line 1
    C:\WINDOWS\PROMPT> python D:\Python\bytsh.py D:\Video\test.mp4

SyntaxError: unexpected character after line continuation character
>>>

Python IDLE:
>>> C:\WINDOWS\PROMPT> python D:\Python\bytsh.py D:\Video\test.mp4
SyntaxError: unexpected character after line continuation character
>>>

which program should I be running this through?


On Sun, Aug 12, 2018 at 12:24 PM, Alan Gauld via Tutor <tutor at python.org>
wrote:

> On 12/08/18 16:52, Nathan Johnson wrote:
> > Okay so I downloaded and saved the script as a .py file in a folder named
> > Python on the D; Drive, and also moved my video file to a folder in my D:
> > drive with the name Video. I tried using it in Command Prompt, Python,
> and
> > Python IDLE, but I got the same error saying
> >
> > SyntaxError: unexpected character after line continuation character
>
> This is a Python error. I suspect you only get this when trying
> to run it from IDLE or inside the Python interpreter. Not from
> the OS command prompt? Its caused by the \ characters which
> Python sees as line continuation characters.
>
> But you should always send us the complete error message not
> just the last line. Although it looks like gobbldegook it is
> actually full of useful data.
>
> But for now I suspect this is all irrelevant to your problem.
> Instead follow the suggestion below...
>
> > I know this is probably user error, but I am a complete novice so I need
> a
> > little more explanation than "provide a file argument" please. I need to
> > know how exactly to implement the file argument you provided.
>
> An "argument" is just the value that you give to a command.
> So a file argument is just the path to a file. You need to
> provide that when you execute the command.
>
> That's what I was showing you here:
>
> >> C:\WINDOWS\PROMPT> python D:\Python\myscript.py D:\Image\myfile.img
>
> It says:
>
> Use the Windows CMD prompt and
>
> Type
>
> python
>
> followed by
>
> the path to your script file
>
> followed by
>
> the path to your image/video file
>
> The last bit (or lack of) is what will generate the file error.
>
>
> --
> 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
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list