Sujet : Re: pathlib.Path.is_file vs os.path.isfile difference
De : list1 (at) *nospam* tompassin.net (Thomas Passin)
Groupes : comp.lang.pythonDate : 08. Mar 2024, 23:57:57
Autres entêtes
Message-ID : <mailman.74.1709939763.3452.python-list@python.org>
References : 1 2
User-Agent : Mozilla Thunderbird
On 3/8/2024 5:14 PM, Albert-Jan Roskam wrote:
On Mar 8, 2024 19:35, Thomas Passin via Python-list <python-list@python.org> wrote:
On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote:
> Hi,
> I was replacing some os.path stuff with Pathlib and I
discovered this:
> Path(256 * "x").is_file() # OSError
> os.path.isfile(256 * "x") # bool
> Is this intended? Does pathlib try to resemble os.path as
closely as
> possible?
You must have an very old version of Python. I'm running 3.12.2 and it
returns False. Either that or that path name exists and throws some
kind of unexpected exception.
====
Hi, I tested this with Python 3.8. Good to know that this was fixed!
We just learned a few posts back that it might be specific to Linux; I ran it on Windows.