[issue30421] Relative include of config files
New submission from Robert Schindler: Hi, When one includes an argument file at the command line using argparse and that file contains another include statement, the inner include path is treated as relative to os.getcwd(), what is not the way people expect it to be, I guess. This patch modifies argparse so that it treats paths of files to include as relative to the location of the file the include was made from. I also pulled statements that I think should not be enclosed by the try/except out of it and changed the workflow so that the file descriptor of an include file is closed before another one is opened by the recursive call to _read_args_from_files again.. That way, the number of file descriptors open at a time is kept low. Best regards Robert -- components: Library (Lib) files: argparse_relative_includes.patch keywords: patch messages: 294086 nosy: roschi priority: normal severity: normal status: open title: Relative include of config files type: behavior versions: Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46881/argparse_relative_includes.patch ___ Python tracker <http://bugs.python.org/issue30421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30421] argparse: relative include of config files
Changes by Robert Schindler : -- title: Relative include of config files -> argparse: relative include of config files ___ Python tracker <http://bugs.python.org/issue30421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30421] argparse: relative include of config files
Changes by Robert Schindler : Added file: http://bugs.python.org/file46882/argparse_relative_includes2.patch ___ Python tracker <http://bugs.python.org/issue30421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30421] argparse: relative include of config files
Robert Schindler added the comment: Hi Louie, oh, I didn't notice that. But that's great news. I'll send a PR soon. Best regards Robert -- ___ Python tracker <http://bugs.python.org/issue30421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30421] argparse: relative include of config files
Changes by Robert Schindler : -- pull_requests: +1792 ___ Python tracker <http://bugs.python.org/issue30421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com