classification
Title: Bug report in python3.6.8 using argparse module
Type: behavior Stage:
Components: Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: DahlitzFlorian, amansi26, remi.lapeyre, terry.reedy
Priority: normal Keywords:

Created on 2020-05-28 10:02 by amansi26, last changed 2020-05-30 02:45 by terry.reedy.

Messages (3)
msg370184 - (view) Author: (amansi26) Date: 2020-05-28 10:02
I am using 3.6.8 version of python.
I am seeing an error as AttributeError: 'Namespace' object has no attribute 'func' while using argparse . The code is working fine with python2.7 argparser.

I see a similar bug [4] reported at python 3.3 and  python3.4. The workaround mentioned works fine for a single level command.
 
Scenarios:
- If there is one command and various subcommands, like [1].The solution works fine.
- But suppose I have a command with mutiple level of subcommands like [2]. In this case if I give [3] as a command the ArgumentParser.prog() takes just the first command as input in this 
  case (open-stack). Hence the parser.print_usage prints [1].
 
 [1] [2] [3]   https://bpa.st/PUPA
 
[4]  https://bugs.python.org/issue16308
msg370187 - (view) Author: RĂ©mi Lapeyre (remi.lapeyre) * Date: 2020-05-28 10:38
Hi amansi26, thanks for reporting this issue.

Without an example program that reproduces it, we won't be able to diagnose and fix it thought. Can you post one?
msg370354 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-30 02:45
3.6 has only gotten security fixed for 1.5 years.  We need a test file that can be run as is in the master branch to see if there is a current bug.
History
Date User Action Args
2020-05-30 02:45:41terry.reedysetnosy: + terry.reedy
messages: + msg370354
2020-05-28 11:40:09DahlitzFloriansetnosy: + DahlitzFlorian
2020-05-28 10:38:10remi.lapeyresetnosy: + remi.lapeyre
messages: + msg370187
2020-05-28 10:02:25amansi26create