os.access with wildcards

Fredrik Lundh fredrik at pythonware.com
Fri Oct 7 11:51:29 CEST 2005

Leif K-Brooks wrote:

>>    os.access(path,mode)
>> where path may contain linux style wildcards.
> os.access(glob.glob(path), mode)

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: access() argument 1 must be string, not list

it's not clear from the OP if he wants

    [os.access(file, mode) for file in glob.glob(path))]

    os.access(glob.glob(path)[0], mode)

or, most likely, simply

    if glob.glob(path):
        ... some matching file exists ...


More information about the Python-list mailing list