Comments (4)
Thanks for the report. It looks like in the main scandir code in the CPython repo this is now handled with a preprocessor if/else. See lines 491-501 here:
#ifdef MS_WINDOWS
# define STAT win32_stat
# define LSTAT win32_lstat
# define FSTAT _Py_fstat_noraise
# define STRUCT_STAT struct _Py_stat_struct
#else
# define STAT stat
# define LSTAT lstat
# define FSTAT fstat
# define STRUCT_STAT struct stat
#endif
You'd be welcome to submit a PR if you'd like. Seeing scandir is now included in Python 3.x itself, I personally don't have time/motivation to work on this repo much anymore. Either way, I'll leave this open for visibility.
from scandir.
I can see that MS_WINDOWS's _Py_stat_struct definition can be seen from python source code, not 3rdparty modules, so maybe redefining is better
from scandir.
attempted. (our company started Py3 migration this year~~)
from scandir.
@cielavenir, thanks for the PR, and I'll take a look at that separately. However, wouldn't a simpler way to address this in your Python 3 codebase be to just use scandir
from the Python 3 stdlib? (It's been in the stdlib since as os.scandir
since Python 3.5.)
If you still need Python 2 and Python 3 compatibility, you can do:
try:
from os import scandir
except ImportError:
from scandir import scandir # fallback for Python < 3.5
from scandir.
Related Issues (20)
- scandir 1.9.0 is broken on openindiana HOT 7
- scandir 1.9.0 broken in Python 2.7.13 HOT 7
- drop old/dead pythons? HOT 9
- test on py37? HOT 2
- pypy3 stat issue HOT 2
- preparing changelog for next release HOT 1
- Request for new release to PyPI >= 1.9.0 HOT 1
- Fix locale/unicode test failures on FreeBSD HOT 1
- Error from running setup.py install on python 2.7.5 win HOT 5
- is there any way to read all file names in the sub directory? HOT 3
- Difference between scandir.walk() and os.walk() HOT 4
- The macOS wheels produced by scandir are overly restrictive in their platform HOT 1
- Wheel support for linux aarch64 HOT 1
- some doubt about your another project :pygit HOT 3
- GIL is not released when dir_entry.stat does a stat syscall HOT 6
- Running on Outdated Python and OS HOT 2
- Windows MAX_PATH limitation on inode call HOT 6
- module FTBFS on python3.9 and 3.10 HOT 2
- 3 fields are labelled "unnamed field" in `repr(scandir.DirEntry.stat())` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scandir.