Eryk Sun <[email protected]> added the comment:
It works as expected for me:
>>> len(p)
261
>>> print(p)
C:\Temp\Jim\Documents\jschw_uiowtv3_old\AppData\Local\Google\Chrome\User
Data\Default\Extensions\nenlahapcbofgnanklpelkaejcehkggg\0.1.823.675_0\notifications\pages\Cashback\components\CashBackResolve\components\RewardsActivation\components\CashbackSectionSimple
os.walk() can list the files in directory `p` if the \\?\ prefix is prepended:
>>> next(os.walk('\\\\?\\' + p))[-1]
['spam.txt']
Without the prefix, the internal os.scandir() call fails, but by default the
error is ignored:
>>> next(os.walk(p))[-1]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
We can print the exception to see that it's the expected ERROR_PATH_NOT_FOUND
(3) error for a path that's too long:
>>> next(os.walk(p, onerror=print))[-1]
[WinError 3] The system cannot find the path specified:
'C:\\Temp\\Jim\\Documents\\jschw_uiowtv3_old\\AppData\\Local\\Google\\Chrome\\User
Data\\Default\\Extensions\\nenlahapcbofgnanklpelkaejcehkggg\\0.1.823.675_0\\notifications\\pages\\Cashback\\components\\CashBackResolve\\components\\RewardsActivation\\components\\CashbackSectionSimple'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46084>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com