Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Real Programmers think better when playing Adventure or Rogue.


devel / comp.lang.python / Re: pathlib.Path.is_file vs os.path.isfile difference

SubjectAuthor
o Re: pathlib.Path.is_file vs os.path.isfile differenceThomas Passin

1
Re: pathlib.Path.is_file vs os.path.isfile difference

<mailman.71.1709928395.3452.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29625&group=comp.lang.python#29625

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: list1@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: pathlib.Path.is_file vs os.path.isfile difference
Date: Fri, 8 Mar 2024 15:06:24 -0500
Lines: 38
Message-ID: <mailman.71.1709928395.3452.python-list@python.org>
References: <DB9PR10MB6689EA455D5C8580B90EA8F383272@DB9PR10MB6689.EURPRD10.PROD.OUTLOOK.COM>
<33cad416-6f2d-4e1e-9c86-227e30e220fd@tompassin.net>
<4TrwyW50knznVDr@mail.python.org>
<4155b23f-f7a0-484f-85f4-5c611908ae0f@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de yaPP+rPknNlmDlLDiM6AIwOFB2+tmbjsFnBhf6bWmU/g==
Cancel-Lock: sha1:J8+2RVy4objTpR7IJFij/mL3W8o= sha256:COJsQihOhocqE+m50nTHK3XWWlrnSgXzn1jJ68gh/ME=
Return-Path: <list1@tompassin.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=tompassin.net header.i=@tompassin.net header.b=AF8cG0LI;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'this:': 0.03; 'traceback':
0.04; '(most': 0.05; 'last):': 0.05; 'python.': 0.08; 'linux':
0.09; 'resemble': 0.09; 'import': 0.15; '>>>>': 0.16; 'false.':
0.16; 'possible?': 0.16; 'received:10.0.0': 0.16;
'received:64.90': 0.16; 'received:64.90.62': 0.16;
'received:64.90.62.162': 0.16; 'received:dreamhost.com': 0.16;
'sorry,': 0.16; 'subject:skip:o 10': 0.16; 'subject:skip:p 20':
0.16; 'windows.': 0.16; 'wrote:': 0.16; 'python': 0.16; 'feb':
0.17; 'grant': 0.17; 'pm,': 0.19; 'to:addr:python-list': 0.20;
'returns': 0.22; 'version': 0.23; 'stuff': 0.25; 'old': 0.27;
'>>>': 0.28; 'header:User-Agent:1': 0.30; '"",': 0.32; 'python-
list': 0.32; 'received:10.0': 0.32; 'received:mailchannels.net':
0.32; 'received:relay.mailchannels.net': 0.32; "i'm": 0.33;
'header:In-Reply-To:1': 0.34; 'running': 0.34; 'file': 0.38;
'try': 0.40; 'should': 0.40; 'skip:o 10': 0.61;
'header:Received:6': 0.67; 'received:64': 0.67; 'skip:f 30': 0.71;
'discovered': 0.80; 'replacing': 0.91
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1709928384; a=rsa-sha256;
cv=none;
b=rp+6DYJsW8oAuTuA58lBFqPRIPzTuM0YPlVFLr/5Q+xr2b3Ein03siLOWEJE0Jv/EMmUPc
EKUT9Aqay1gEZQe4/Rk28D1C9C9B4s6Bl6hqSrDDOxJYLva/awIdrYGCvwRHOqivGSbjxf
GxlhIc/nzBJ36FXpE6clzT0Pu/+3BvY38TSCO/ZVyhWfZLuCUtAloxZ+z+Hw3BaJZNfi7V
nLj241bk5Fizx7s4v7ezqsmhOaMLasY+yqrP5IRrpuN9aQb22SBjuYGYI+3d7WwqQ3U2as
btl/fhjhGR7FjyYh/haxlv07F/+TAp8xBdMJEtbLVV+17nssOkTw9NKN2xCvAg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1709928384;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=4HOvJX3x1J9/UaSBxvKi/7k8CXb1j9em2/PlvMq1kQk=;
b=YZslF6pk5Msl5sdEWU8HPswZVibGQih5TCQQzFsTGGwCsa2cRh8Cy2PvUwZ54fUYQo3qeZ
RZh+LNzaNPK7P3uzvh0XXaGI0OQStiMcxs8O117vWSseI1fAQxGek+6GEKngyM0J7jlPUu
P+FOST1Juz4alyvkg5a12Xkf37Wg7VD3KoVQLPd3hHfqtABD9T1wzwT/0yVuf6ArLmUMdZ
3FFDlATknwhH2L0JK3Rl7e5fFmDK/Bdf6EAMtMn3UGECFFZDLGTMnF7jVIZGswrMqLWYap
y2aDK9RYZyZh9OTaRtmSDzS5eP/b1v2TRD8cWl2vwbzxDtv/aIeiYUaicSDgUQ==
ARC-Authentication-Results: i=1; rspamd-5db57bc4b6-cmkh6;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Cooing-Turn: 0d68c83c48be4cbb_1709928384891_2708042168
X-MC-Loop-Signature: 1709928384891:2557796742
X-MC-Ingress-Time: 1709928384891
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1709928384;
bh=4HOvJX3x1J9/UaSBxvKi/7k8CXb1j9em2/PlvMq1kQk=;
h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
b=AF8cG0LIFtSU8h0RBPpA+GjUGPKJ+Sq4Vyh+B/cF60/YNWC5sJ7WJiw75AP98GVO5
+KvhpUeIahjHAYz5Oq8EYjUUW6uRxJjt9x8EFeb/gUJWYSfk0v6eySNQ6U3V4nTnMo
MLFsElQ/kvB71/nsLB7lXTuyQft5+lDeh2afY0WLmGlGMvZwEUj/ymiSFrjzUxz3Y9
i4JqY4g/cuTk+RBeny7n+FHGtE3jCHEmtvX34tRg+dtSoJSrxl2KvHxRQ+G72Slmo+
+Df3+O0W4oxt7T9cMlYagsvGWlJ6pAAM3Vc8G1Vni3ybkZYjjOoXqtzd9I8LOD3tdL
IMzqsG59980LQ==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <4TrwyW50knznVDr@mail.python.org>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <4155b23f-f7a0-484f-85f4-5c611908ae0f@tompassin.net>
X-Mailman-Original-References: <DB9PR10MB6689EA455D5C8580B90EA8F383272@DB9PR10MB6689.EURPRD10.PROD.OUTLOOK.COM>
<33cad416-6f2d-4e1e-9c86-227e30e220fd@tompassin.net>
<4TrwyW50knznVDr@mail.python.org>
 by: Thomas Passin - Fri, 8 Mar 2024 20:06 UTC

On 3/8/2024 2:21 PM, Grant Edwards via Python-list wrote:
> On 2024-03-08, 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.
>
> It throws OSError with Python 3.11.8 on Linux.

Sorry, I should have said on Windows.

>
> $ python
> Python 3.11.8 (main, Feb 23 2024, 16:11:29) [GCC 13.2.1 20240113] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import pathlib
>>>> pathlib.Path(256 * "x").is_file()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python3.11/pathlib.py", line 1267, in is_file
> return S_ISREG(self.stat().st_mode)
> ^^^^^^^^^^^
> File "/usr/lib/python3.11/pathlib.py", line 1013, in stat
> return os.stat(self, follow_symlinks=follow_symlinks)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> OSError: [Errno 36] File name too long: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
>>>>
>>>> import os
>>>> os.path.isfile(256 * "x")
> False
>

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor