-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Description
Feature or enhancement
Proposal:
The following line errors on Windows
import fcntlIt's error is not helpful at all, but powers library code sysadmins use, such as sh:
- https://sh.readthedocs.io/en/latest/sections/sudo.html#etc-sudoers-nopasswd
- https://pypi.org/project/sh/
To provide the minimum amount of confusion, I've written a polyfill:
https://github.com/Lewiscowles1986/python-fcntl
It writes to stderr and exits with non-zero error code, so that CI systems can know it doesn't work.
I've also tested it using sh on both mac and windows. Essentially it just gives a nicer error, which signposts the user to maybe use Docker (if they insist on using non linux or darwin systems).
All I'm shooting for here is a better error message, than an import error, for something folks have come to expect as part of the standard library (probably their fault, but I came across this with a user of mastodon complaining about Python, not sh and not fcntl)
https://mastodon.social/@mistersql/113314636889503344
I have asked PyPi to release the fcntl name to me, so that folks can pip install fcntl which I tested using a virtual environment using poetry, within the sh project itself to check it works.
But a nicer error for others without the shenanigans I went through might be better for all.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response