[Python] Wildcard * not interpreted by python argparse on Windows [closed]

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to write a script that could take all files in a directory and allowing the user to use the * to refer to multiple files.

    This is the line in which I set up the parser to receive the input files:

    parser.add_argument('-f', '--files', help='The files to compare.', required=True, nargs='+')


    This is the line of the error

    Invalid argument: '.\\rmsd\\*.xyz'


    This is the code I run to execute the script

    python .\rsmd.py -r .\rmsd\1.xyz -f .\rmsd\*.xyz


    My purpose is to let the user use the script in Windows and in Linux.

    Continue reading...

Compartilhe esta Página