Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Improve permission error messages in pdb and asyncio.tools#134290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
Add help texts for Linux, macOS, and Windows to guide users inresolving permission errors when attaching to a process using the-p option.
Add platform-specific guidance to help users resolve permission errorswhen inspecting running processes with asyncio.tools.
2b62a35
to6101e33
CompareThis function is called when a PermissionError is encountered while trying | ||
to attach to a process. | ||
""" | ||
system = platform.system() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
sys is already imported, so you can usesys.platform
gaogaotiantian commentedMay 21, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Should this live in the code? I think this should live in the docs and we should just print a link for it. This documentation should probably live with |
pablogsal commentedMay 21, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think so. We want to provide actionable output to the users right where the error happens and not just in the docs. We could put it somewhere in the docs and drop a link there though although I think that is slight worse experience. But I don't feel very strongly |
I think this is too much text living in the code - especially with multiple copies. If we have a third library that utilizes I suggest that we put a link to the docs in the |
This PR enhances the user experience when a
PermissionError
occurs while attempting to attach to a process usingpdb -p
or tools likeasyncio ps
andasyncio pstree
. It adds platform-specific guidance for Linux, macOS, and Windows to help users understand why the operation failed and how to resolve it (e.g., usingsudo
, adjusting system settings, or enabling debugging privileges).Currently, the same logic is duplicated in both
pdb
andasyncio.tools
. If anyone has recommendations on how to avoid this duplication, I’d appreciate input. I couldn't find a clear shared location in the standard library where this kind of utility logic would belong.