[issue36863] argparse doesn't like options in the middle of arguments

2019-05-27 Thread paul j3


paul j3  added the comment:

This is intended behavior of multi-nargs positionals.  The 'one' string is 
consumed by the 'file' argument, and there's no positional argument left to 
consume the other strings.  

The topic was raised and discussed previously  

https://bugs.python.org/issue14191 -argparse doesn't allow optionals within 
positionals

The fix is to use 'parser.parse_intermixed_args()', as documented in

https://docs.python.org/3/library/argparse.html#intermixed-parsing

--
nosy: +paul.j3
resolution:  -> duplicate
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-11 Thread rhubarbdog x


rhubarbdog x  added the comment:

I've just done a test and from a command shell (bash or whatever) the following 
python script when ran produces the following

$ python3 command.py 0ne thwo three
files:  ['0ne', 'thwo', 'three']
sensors 1
freq 1200

$ python3 command.py -s 5 0ne thwo three
files:  ['0ne', 'thwo', 'three']
sensors 5
freq 1200

$ python3 command.py  0ne -s 5 thwo three
usage: command.py [-h] [-s SENSORS] [-f FREQ] file [file ...]
command.py: error: unrecognized arguments: thwo three

i've attached the program command.py

--
status: pending -> open
Added file: https://bugs.python.org/file48327/command.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-10 Thread Martin Panter

Martin Panter  added the comment:

The “cmd” module doesn’t use “argparse” as far as I can see. You might have to 
provide more information or code for someone to make sense of or reproduce your 
bug.

Also, see Issue 14191 which added new “parse_[known]_intermixed_args” APIs in 
3.7, and have a look at Issue 15112, about intermixing options between 
particular kinds of positional parameters.

--
nosy: +martin.panter
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-10 Thread Glenn Linderman


Change by Glenn Linderman :


--
nosy: +v+python

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-09 Thread Larry Hastings


Change by Larry Hastings :


--
nosy:  -larry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-09 Thread rhubarbdog x


rhubarbdog x  added the comment:

This is when running is a shell which inherits from cmd.Cmd

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-09 Thread SilentGhost


Change by SilentGhost :


--
components: +Library (Lib) -Argument Clinic
stage:  -> test needed
type:  -> behavior
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-09 Thread rhubarbdog x


New submission from rhubarbdog x :

I've found a bug with argparse and reported it upstream.
`command --option source destination` works
`command soucre destination --option` works
but `command source --option destination` doesn't outputting the usage text 
block associated `do_command` method and outputs error message `command: error: 
unrecognized arguments: destination`

--
components: Argument Clinic
messages: 341973
nosy: larry, rhubarbdog x
priority: normal
severity: normal
status: open
title: argparse doesn't like options in the middle of arguments

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com