This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Colin David Chen
Recipients Colin David Chen
Date 2016-12-14.22:08:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481753319.18.0.913748060881.issue28975@psf.upfronthosting.co.za>
In-reply-to
Content
os.walk in 3.6rc1 (Windows) appears to generate different output depending on its invocation.

In the first invocation, I use the generator to yield one result at a time:
source = "C:\\cdchen_data\\downloads\\python-xlib-0.18\\"
texasranger = os.walk(Path(source))
roottree = [next(texasranger)]
roottree[0][0]
Output:
'C:\\cdchen_data\\downloads\\python-xlib-0.18'

The same result occurs when using the generator in a for loop.

In the second invocation, I generate the complete list first:
sourcetree = [x for x in os.walk(source)]
sourcetree[0][0]

Output:
'C:\\cdchen_data\\downloads\\python-xlib-0.18\\'

The particular behavior causing me trouble is the omission in the first result of the final '\\'. I checked in 2.7.6 and os.walk is consistent and I believe more correct in that it will yield equivalent results and includes the '\\'.

Not sure if earlier Python 3 implementations have this problem, I couldn't get 3.5 to run this function without failing.
History
Date User Action Args
2016-12-14 22:08:39Colin David Chensetrecipients: + Colin David Chen
2016-12-14 22:08:39Colin David Chensetmessageid: <1481753319.18.0.913748060881.issue28975@psf.upfronthosting.co.za>
2016-12-14 22:08:39Colin David Chenlinkissue28975 messages
2016-12-14 22:08:38Colin David Chencreate