On Saturday, 28 May 2016 18:02:06 UTC+10, Sayth Renshaw  wrote:
> So how do i get argparse to read the file arguments correctly?
> 
> Looking at the namespace it all gets pushed into path and extension remains 
> empty.
> 
> [sayth@localhost pyXML]$ python3 racemeeting.py data/ *.xml
> Namespace(extension='', path=['data/', '*.xml'])
> 
> This is the section I am running
> 
> parser = argparse.ArgumentParser()
> parser.add_argument("path", nargs="+")
> parser.add_argument('-e', '--extension', default='',
>                     help='File extension to filter by.')
> 
> args = parser.parse_args()
> name_pattern = "*" + args.extension
> print(args)
> 
> Sayth

Ah if only i used argparse properly

python racemeeting.py data/ -e *.xml

Sayth
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to