[issue19959] argparse.FileType does not expand tilde "~"

2016-04-02 Thread Martin Panter

Martin Panter added the comment:

I’m not super familiar with argparse, but to get a Path or FilePath object, 
can’t you use that directly instead of argparse’s FileType class?

The proposal would conflict with escaping a literal tilde (~) in the shell. It 
would make it harder for the end user to specify a real file name that starts 
with a tilde.

--
status: open -> closed

___
Python tracker 

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



[issue19959] argparse.FileType does not expand tilde "~"

2016-03-28 Thread Julian Berman

Julian Berman added the comment:

My support (or really, asking for a more generic callable) was to enable other 
use cases, not this one specifically -- e.g., allowing for constructing a 
pathlib Path or a twisted.python.filepath.FilePath without needing to write 
one's own argparse action.

For ~ specifically -- it's true if you're going to go via a shell it'd be 
expanded first, but I'm not sure that'd count as "conflicting" with the shell's 
expansion, it just won't be needed. Consider that 
twisted.python.filepath.FilePath for example, expands ~ in its constructor -- 
people often construct paths in other places and occasionally expansion is 
convenient. Like in test cases.

I certainly don't feel strongly about the patch though, especially as-is.

--
status: pending -> open

___
Python tracker 

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



[issue19959] argparse.FileType does not expand tilde "~"

2016-03-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue19959] argparse.FileType does not expand tilde "~"

2016-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm with Martin.

--
nosy: +serhiy.storchaka
status: pending -> open

___
Python tracker 

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



[issue19959] argparse.FileType does not expand tilde "~"

2016-03-27 Thread Martin Panter

Martin Panter added the comment:

I think this change is not appropriate for Unix, because it is redundant and 
would conflict with normal shell expansion. I’m not familiar with Windows, but 
I suspect it is not appropriate there either (neither Windows command shells 
nor argparse do wildcard * and ? glob expansion, right?). Pending response from 
Garth or Julian.

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

___
Python tracker 

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



[issue19959] argparse.FileType does not expand tilde ~

2013-12-18 Thread paul j3

paul j3 added the comment:

Normally the unix shell takes care of this expansion.  If I call a simple 
script that prints sys.argv and runs a simple parser, I get:

2135:~/mypy$ python2.7 filetypetest.py ~/mypy/test.txt
['filetypetest.py', '/home/paul/mypy/test.txt']
Namespace(file=open file '/home/paul/mypy/test.txt', mode 'r'...)

I have to quote the argument '~/mypy/test.blog' to bypass this expansion.

This is under Linux (bash).  Is Windows or Mac different?

My impression is that `FileType` has been provided as an example of a custom 
`type`, as opposed to a comprehensive file handler.  But I can't quote a 
developer on this.  

http://bugs.python.org/issue13824 is a bug report that worries that 
'argparse.FileType opens a file and never closes it'.  There are some comments 
there about whether it is appropriate to expand on the capabilities of FileType.

--
nosy: +paul.j3

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



[issue19959] argparse.FileType does not expand tilde ~

2013-12-14 Thread Julian Berman

Julian Berman added the comment:

Why not take this a step further and make it take a callable that's expected to 
take the command line argument and coerce it into a path

--
nosy: +Julian

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



[issue19959] argparse.FileType does not expand tilde ~

2013-12-12 Thread Garth Bushell

New submission from Garth Bushell:

argparse.FileType does not expand tilde ~. 

This would be useful to take file parameters beginning with ~ and use 
os.path.expanduser to expand this.

--
components: Library (Lib)
messages: 205949
nosy: garthy
priority: normal
severity: normal
status: open
title: argparse.FileType does not expand tilde ~
versions: Python 3.5

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



[issue19959] argparse.FileType does not expand tilde ~

2013-12-12 Thread Garth Bushell

Garth Bushell added the comment:

Add patch to add an option to argparse.FileType to enable expanduser.

--
keywords: +patch
Added file: 
http://bugs.python.org/file33100/19959-argparse_filetype_expanduser.patch

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



[issue19959] argparse.FileType does not expand tilde ~

2013-12-12 Thread Garth Bushell

Changes by Garth Bushell ga...@garthy.com:


--
type:  - enhancement

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



[issue19959] argparse.FileType does not expand tilde ~

2013-12-12 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag

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



[issue19959] argparse.FileType does not expand tilde ~

2013-12-12 Thread Garth Bushell

Garth Bushell added the comment:

Update patch to include docs.

--
Added file: 
http://bugs.python.org/file33102/19959-argparse_filetype_expanduser_plus_doc.patch

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