[issue11874] argparse assertion failure with brackets in metavars

2011-04-19 Thread Hartmut Niemann

New submission from Hartmut Niemann :

I run this script with option --help
-8<--
import argparse
parser = argparse.ArgumentParser()
parser.add_argument ('--from-itm', 
dest="from_itm",action="store",default=None,help ="Source ITM file", 
metavar="ITMFILENAME")
parser.add_argument 
("--from-fbm-sigtab",dest="from_sigtab",action="store",default=None,help="Source
 signal FB", metavar=" [LIB,]FBNAME")
parser.add_argument ("--c",dest="f",metavar="x]d")
args = parser.parse_args()
-8<
and I get an assertion failure:
-8<
D:\temp>argparsebug.py --help
Traceback (most recent call last):
  File "D:\temp\argparsebug.py", line 6, in 
args = parser.parse_args()
  File "C:\Python27\lib\argparse.py", line 1678, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "C:\Python27\lib\argparse.py", line 1710, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "C:\Python27\lib\argparse.py", line 1916, in _parse_known_args
start_index = consume_optional(start_index)
  File "C:\Python27\lib\argparse.py", line 1856, in consume_optional
take_action(action, args, option_string)
  File "C:\Python27\lib\argparse.py", line 1784, in take_action
action(self, namespace, argument_values, option_string)
  File "C:\Python27\lib\argparse.py", line 993, in __call__
parser.print_help()
  File "C:\Python27\lib\argparse.py", line 2303, in print_help
self._print_message(self.format_help(), file)
  File "C:\Python27\lib\argparse.py", line 2277, in format_help
return formatter.format_help()
  File "C:\Python27\lib\argparse.py", line 278, in format_help
help = self._root_section.format_help()
  File "C:\Python27\lib\argparse.py", line 208, in format_help
func(*args)
  File "C:\Python27\lib\argparse.py", line 329, in _format_usage
assert ' '.join(opt_parts) == opt_usage
AssertionError
--8<---
It must be the combination of several argument lines because when I 
comment out one of the add_arguments, it works.

Is this a bug or do I do things I shouln't?
If it is not allowed to use [] in metavars (what I wanted was 
metavar='[optional,]mantatory'), I' like to receive a readable error message.

With best regards
Hartmut Niemann

--
components: None
messages: 134021
nosy: htnieman
priority: normal
severity: normal
status: open
title: argparse assertion failure with brackets in metavars
type: behavior
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue11874>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24908] sysconfig.py and distutils.sysconfig.py disagree on directory spelling on Windows

2015-08-21 Thread Hartmut Niemann

New submission from Hartmut Niemann:

Lib\sysconfig.py uses '{installed_base}/Include'
as the include directory on Windows, 

Lib\distutils\sysconfig.py uses 
elif os.name == "nt":
return os.path.join(prefix, "include")

which is normally harmless because windows file systems
are case-preserving, but case-ignoring, but it leads to
a warning from pyinstaller:
https://github.com/pyinstaller/pyinstaller/issues/783

The directory referred to has a lowercase i (on my machine).

In my opinion both modules should use the spelling
that the installer uses when creating the directories.

--
messages: 248949
nosy: htnieman
priority: normal
severity: normal
status: open
title: sysconfig.py and distutils.sysconfig.py disagree on directory spelling 
on Windows
versions: Python 2.7, Python 3.4

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