Author ciupicri
Recipients ciupicri
Date 2018-12-10.10:54:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544439282.17.0.788709270274.issue35453@psf.upfronthosting.co.za>
In-reply-to
Content
pathlib.Path.glob and pathlib.Path.rglob don't work with os.PathLike patterns.

Short example:

from pathlib import Path, PurePath
# fails
tuple(Path('/etc').glob(PurePath('passwd')))    # TypeError
tuple(Path('/etc').rglob(PurePath('passwd')))   # TypeError
tuple(Path('C:\\').glob(PurePath('Windows')))   # AttributeError
tuple(Path('C:\\').rglob(PurePath('Windows')))  # AttributeError
# works
from os import fspath
tuple(Path('/etc').glob(fspath(PurePath('passwd'))))
tuple(Path('/etc').rglob(fspath(PurePath('passwd'))))
tuple(Path('C:\\').glob(fspath(PurePath('Windows'))))
tuple(Path('C:\\').rglob(fspath(PurePath('Windows'))))
History
Date User Action Args
2018-12-10 10:54:42ciupicrisetrecipients: + ciupicri
2018-12-10 10:54:42ciupicrisetmessageid: <1544439282.17.0.788709270274.issue35453@psf.upfronthosting.co.za>
2018-12-10 10:54:42ciupicrilinkissue35453 messages
2018-12-10 10:54:41ciupicricreate