Closed Changaco closed 9 years ago
The change in the argparse
module:
--- argparse-2.7.8.py 2014-12-18 18:44:37.956126224 +0100
+++ argparse-2.7.9.py 2014-12-18 18:44:23.426106089 +0100
@@ -1089,7 +1089,14 @@
# parse all the remaining options into the namespace
# store any unrecognized options on the object, so that the top
# level parser can decide what to do with them
- namespace, arg_strings = parser.parse_known_args(arg_strings, namespace)
+
+ # In case this subparser defines new defaults, we parse them
+ # in a new namespace object and then update the original
+ # namespace for the relevant parts.
+ subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
+ for key, value in vars(subnamespace).items():
+ setattr(namespace, key, value)
+
if arg_strings:
vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)
Thanks for bringing this up. I've restarted our latest master build on Travis-CI and yeah... now the build on python 2.7.9 is failing.
I'm not very familiar with argparse to be honest, but it seems that your PR fixes those tests that are broken on 2.7.9 now. Although it introduced some problems with test_export.py
I've found a backward-compatible way of fixing the problem, tests are now passing.
Thanks but now I think it's even more broken than before. A simple honcho --help
gives me
usage: honcho [-e ENV] [-d APP_ROOT] [-f PROCFILE] [-v]
{check,export,help,run,start,version} ...
honcho: error: too few arguments
on both python 2.7 (including 2.7.9) and 3.4.
I will have to take a closer look on this I guess.
Problem fixed by removing add_help=False
.
Thank you for your help. I've reworked this slightly and committed it as 1319da7. It's now released as v0.6.4.
Thank you for your help. I have had a related issue in electrum.
As a workaround, I reverted the last change to argparse._SubParsersAction.__call__
see https://github.com/spesmilo/electrum/commit/1d1d76b1ad8e2e93b0daa52469dcbaef6322e110
With python 2.7.9 honcho doesn't read the env files provided via the
-e
command line argument, because of a change in theargparse
module.