title: Python: OSError: [Errno 22] Invalid argument: '*.txt'
body: <p>I have a script that I want to use in order to enumerate all file types in a folder:</p>
  
  <pre><code>#!/usr/bin/env python
  # -*- coding: utf-8 -*-
  
  import sys
  import argparse
  import magic
  import os
  
  # Argparse starts here
  parser = argparse.ArgumentParser()                              
  parser.add_argument('-input', dest='input',help="input one or more files",nargs='+',metavar=None)                           
  args = parser.parse_args()
  
  for files in args.input:
      if magic.from_file(files,mime=True) == "text/plain":
          print (files, "=" , magic.from_file(files,mime=True) )
  </code></pre>
  
  <p>it works pretty well when I input a file:</p>
  
  <p><a href="https://i.stack.imgur.com/jtMQB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jtMQB.png" alt="enter image description here"></a></p>
  
  <p>even when I input two files:</p>
  
  <p><a href="https://i.stack.imgur.com/27goK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/27goK.png" alt="enter image description here"></a></p>
  
  <p>but not when I input <strong>ALL</strong> files:</p>
  
  <p><a href="https://i.stack.imgur.com/cPBLV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cPBLV.png" alt="enter image description here"></a></p>
  
  <p>The error says:</p>
  
  <pre><code>Traceback (most recent call last):
    File "Test.py", line 15, in &lt;module&gt;
      if magic.from_file(files,mime=True) == "text/plain":
    File "C:\Users\FrancescoM\AppData\Local\Programs\Python\Python36-32\lib\site-packages\magic\magic.py", line 135, in from_file
      return m.from_file(filename)
    File "C:\Users\FrancescoM\AppData\Local\Programs\Python\Python36-32\lib\site-packages\magic\magic.py", line 85, in from_file
      with open(filename):
  OSError: [Errno 22] Invalid argument: '*.txt'
  </code></pre>
  
  <p>But <code>*.txt</code> is exactly what I want to input; I also would like to input whatever file <code>*.*</code> </p>
  
  <p>Is this a problem related to <code>python-magic</code> or caused by the way I input the files? </p>