[issue33392] pathlib .glob('*/') returns files as well as directories
robbuckley <r...@buckleynet.uk> added the comment: I checked this on Mac and Windows, pathlib and the old glob std lib behave the same on both in this respect On Tue, 1 May 2018, 18:35 Emily Morehouse, <rep...@bugs.python.org> wrote: > > Emily Morehouse <em...@cuttlesoft.com> added the comment: > > Good find -- I agree that when using Path.cwd().glob('*/'), it should only > return directories. This follows the original glob library's functionality > as well as the Unix expectation (I believe Windows as well, but I'll double > check). > > I'll work on a fix! > > -- > assignee: -> emilyemorehouse > nosy: +emilyemorehouse > > ___ > Python tracker <rep...@bugs.python.org> > <https://bugs.python.org/issue33392> > ___ > -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33392> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33392] pathlib .glob('*/') returns files as well as directories
robbuckley <r...@buckleynet.uk> added the comment: this is workaroundable via constructions like: list(x for x in p.glob('*/') if x.is_dir()) but I think there's value in behaving like glob.glob(), and keystroke avoidance for what must be a fairly common use case -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33392> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33392] pathlib .glob('*/') returns files as well as directories
New submission from robbuckley <r...@buckleynet.uk>: Path.cwd().glob('/*') seems to yield all files and folders in cwd, the same as .glob('*'). I believe that glob('*/') should yield only directories, and glob('*') all files and directories. this behaviour isnt documented one way or the other. But it would be consistent with glob.glob() console dump follows: Python 3.6.5 |Anaconda custom (64-bit)| (default, Mar 29 2018, 13:14:23) Type 'copyright', 'credits' or 'license' for more information IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: import os In [2]: from pathlib import Path In [6]: import glob In [13]: list(p.glob('*/')) Out[13]: [PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f1.txt'), PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f3.txt'), PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/d1'), PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f2.txt'), PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/d2')] In [14]: list(p.glob('*')) Out[14]: [PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f1.txt'), PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f3.txt'), PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/d1'), PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f2.txt'), PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/d2')] In [15]: glob.glob(os.path.join(str(p), '*/')) Out[15]: ['/Users/robertbuckley/python-scripts/pathlib_bug/d1/', '/Users/robertbuckley/python-scripts/pathlib_bug/d2/'] In [16]: glob.glob(os.path.join(str(p), '*')) Out[16]: ['/Users/robertbuckley/python-scripts/pathlib_bug/f1.txt', '/Users/robertbuckley/python-scripts/pathlib_bug/f3.txt', '/Users/robertbuckley/python-scripts/pathlib_bug/d1', '/Users/robertbuckley/python-scripts/pathlib_bug/f2.txt', '/Users/robertbuckley/python-scripts/pathlib_bug/d2'] -- messages: 315949 nosy: robbuckley priority: normal severity: normal status: open title: pathlib .glob('*/') returns files as well as directories type: behavior versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33392> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors
robbuckley <r...@buckleynet.uk> added the comment: hi, as the reporter i just want to say this is working for me with 3.6.3. Regarding https://bugs.python.org/issue30581#msg301150, I take your point that a lot of multiprocessing using the standard libraries may not benefit, as processes may be restricted to the processor group of the parent process (python). For my use case it works well: I launch a queue of blocking jobs, using a thread pool. Each thread launches 1 jobsubprocess.subprocess.run(), where the thread pool size is equal to number of processors reported by os.cpu_count(). Since the OS controls the scheduling in this case, it works perfectly well with 2 processor groups. thanks :-) -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue30581> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors
robbuckley added the comment: yes, i believe its reporting the number of processors in the current group only, not across all groups. attached output of windows sysinternals/coreinfo showing 2 processor groups see https://github.com/giampaolo/psutil/issues/771 for some further disucssion of this topic the maintainer of psutil asked me to raise this bug, also had a quick check on #python IRC. Its my first bug on bugs.python.org so if you need more info just let me know -- Added file: http://bugs.python.org/file46928/ci.txt ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30581> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors
New submission from robbuckley: os.cpu_count() seems to report incorrect values on windows systems with >64 logical processors tried it on 2 similar systems, both running windows 7 / 10 with python 3.6.1 64bit (anaconda): platform1 - 2x Xeon E5-2698v4. 20 cores/CPU = total 80 logical cpus with hyperthreading platform2 - 2x Xeon E5-2697v3. 14 cores/CPU = total 56 logical cpus with hyperthreading os.cpu_count() reports 40 cores on platform1 and 56 on platform2 I would expect 80 and 56 respectively. I suppose this is because the windows api call used is not aware of processor groups, and reports only the number of processors in the current processor group ( eg GetSystemInfo vs GetMaximumProcessorCount ) -- components: Windows messages: 295254 nosy: paul.moore, robbuckley, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open type: behavior versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30581> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com