Message344658
If you will run `python test.py hello.txt, where test.py is:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('echo', type=argparse.FileType)
args = parser.parse_args()
print(args.echo)
You will receive:
FileType('hello.txt')
I think that can be confusing for someone who will forget to invoke FileType constructor.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, June 4, 2019 10:27 PM, Michele Angrisano <report@bugs.python.org> wrote:
>
>
> Michele Angrisanomichele.angrisano@gmail.com added the comment:
>
> Reading the examples in the doc, it's clear the behavior when FileType takes an argument. What's the behavior of FileType when is called without any argument?
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> nosy: +mangrisano
>
> Python tracker report@bugs.python.org
> https://bugs.python.org/issue37150 |
|
Date |
User |
Action |
Args |
2019-06-04 23:50:25 | zygocephalus | set | recipients:
+ zygocephalus, paul.j3, josh.r, mangrisano |
2019-06-04 23:50:25 | zygocephalus | link | issue37150 messages |
2019-06-04 23:50:25 | zygocephalus | create | |
|