Message277611
I'm using Python 3.5.2 on Windows 10 Pro to run the following code with the attached file structure.
The test code is:
from os import DirEntry, scandir
def test_is_dir():
for item in os.scandir(TEST_DIR):
if item.is_dir:
print(item.path)
return
TEST_DIR = '.'
test_is_dir()
The console output is:
===============
Connected to pydev debugger (build 162.1967.10)
.\20160707
.\scratchpad.py
Process finished with exit code 0
===============
I would expect to only see '.\20160707', but "if item.is_dir:" always evaluates to True.
I notice that changing the import line to "from os import DirEntry, scandir" yields the exception "ImportError: cannot import name 'DirEntry'". |
|
Date |
User |
Action |
Args |
2016-09-28 12:47:27 | David Staab | set | recipients:
+ David Staab, paul.moore, tim.golden, zach.ware, steve.dower |
2016-09-28 12:47:27 | David Staab | set | messageid: <1475066847.35.0.133990491826.issue28299@psf.upfronthosting.co.za> |
2016-09-28 12:47:27 | David Staab | link | issue28299 messages |
2016-09-28 12:47:27 | David Staab | create | |
|