Author David Staab
Recipients David Staab, paul.moore, steve.dower, tim.golden, zach.ware
Date 2016-09-28.12:47:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1475066847.35.0.133990491826.issue28299@psf.upfronthosting.co.za>
In-reply-to
Content
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'".
History
Date User Action Args
2016-09-28 12:47:27David Staabsetrecipients: + David Staab, paul.moore, tim.golden, zach.ware, steve.dower
2016-09-28 12:47:27David Staabsetmessageid: <1475066847.35.0.133990491826.issue28299@psf.upfronthosting.co.za>
2016-09-28 12:47:27David Staablinkissue28299 messages
2016-09-28 12:47:27David Staabcreate