[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2022-03-21 Thread Jeremy Kloth
Change by Jeremy Kloth : -- pull_requests: -30123 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2022-03-21 Thread Jeremy Kloth
Change by Jeremy Kloth : -- pull_requests: +30123 pull_request: https://github.com/python/cpython/pull/32032 ___ Python tracker ___

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2022-03-21 Thread Jeremy Kloth
Change by Jeremy Kloth : -- pull_requests: -30121 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2022-03-21 Thread Jeremy Kloth
Change by Jeremy Kloth : -- keywords: +patch nosy: +jkloth nosy_count: 7.0 -> 8.0 pull_requests: +30121 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32032 ___ Python tracker

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz
Jim Schwartz added the comment: Please let me know if you are able to reproduce this issue. -- ___ Python tracker ___ ___

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz
Jim Schwartz added the comment: my c drive and h drive are both internal drives and I run the python script from my user directory on my c drive. Not sure if that makes any difference. Just trying to think of things that might help you reproduce and fix this. --

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz
Jim Schwartz added the comment: when I run the following command: python "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py" "C:\\" I get this output: ... Traceback (most recent call last): File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py",

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz
Jim Schwartz added the comment: the issue is with the scandir script, not the os_walk script. I tried to upload the scandir python script before, but I guess it didn't upload. When I was running the two scripts, I used an input of C:\\ as the input parameter. Hope that helps. --

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun
Eryk Sun added the comment: > but errors in DirEntry.is_dir() and DirEntry.is_symlink() > are always ignored In Windows, is_symlink() won't fail due to a long path, since that information comes from the directory listing, but is_dir() might fail for a long path if it's a symlink to a

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: os.walk() has been implemented via os.scandir(), but by default it ignores OSErrors raised by os.scandir(), DirEntry.is_dir() and DirEntry.is_symlink(). You can get errors raised by os.scandir() if specify the onerror argument, but errors in

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun
Eryk Sun added the comment: If I had long paths enabled, then next(os.walk(p, onerror=print)) would not have printed the error that I showed in the example and would not have immediately raised StopIteration. Instead it would have returned a (dirpath, dirnames, filenames) result for

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz
Jim Schwartz added the comment: do you have this registry entry set to 1: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled set to 1. It works if you do. What version of windows do you have? I have version 21H2 (OS Build 19044.1387). I don't have windows 11

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun
Eryk Sun 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

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz
Jim Schwartz added the comment: yes, I do. C:\Users\Jim\Documents\jschw_uiowtv3_old\AppData\Local\Google\Chrome\User

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun
Eryk Sun added the comment: > Python 3.9.6 scan_dir returns filenotfound on long paths, > but os_walk does not. This would be surprising. os.walk() has been implemented via os.scandir() since Python 3.5. Do you have a concrete example of the directory structure to test? > I see that many

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz
Jim Schwartz added the comment: Here's the second file that works just fine under python 3.9 (by the way, I am using Windows 64-bit). I didn't test this on later python versions, however, nor did I test it on 32-bit versions. I see that many people on the internet have said to change the

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz
New submission from Jim Schwartz : Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not. I've enclosed sample scripts that compare the two and have returned the results. the windows 10 registry entry to extend the path names fixes this issue