Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
ivonastojanovic wants to merge3 commits intopython:main
base:main
Choose a base branch
Loading
fromivonastojanovic:permission_error_message

Conversation

ivonastojanovic
Copy link
Contributor

This PR enhances the user experience when aPermissionError 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 bothpdb 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.

@ivonastojanovic
Copy link
ContributorAuthor

CC@pablogsal

@gaogaotiantian
Copy link
Member

gaogaotiantian commentedMay 21, 2025
edited
Loading

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 withsys.remote_exec. We don't want to duplicate this everywhere that usessys.remote_exec(). I don't think we should have this big chunk of clearly documentation in the code itself.

@pablogsal
Copy link
Member

pablogsal commentedMay 21, 2025
edited
Loading

Should this live in the code? I think this should live in the docs and we should just print a link for it.

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

@gaogaotiantian
Copy link
Member

I think this is too much text living in the code - especially with multiple copies. If we have a third library that utilizessys.remote_exec, are we going to replicate the whole text again? Under the hood, this is an issue withsys.remote_exec, not the modules that use it. For users that usesys.remote_exec directly, they'll still be confused.

I suggest that we put a link to the docs in thePermissionError itself as a message, so it would be simply shown in the traceback.

@pablogsal
Copy link
Member

I think this is too much text living in the code - especially with multiple copies. If we have a third library that utilizessys.remote_exec, are we going to replicate the whole text again? Under the hood, this is an issue withsys.remote_exec, not the modules that use it. For users that usesys.remote_exec directly, they'll still be confused.

Maybe, but one of these cases is not even usingremote_exec so is not true that this is an issue withremote_exec. Also,remote_exec is low level so it doesn't need to be prescriptive. Indeed, for pdf is an implementation detail so it doesn't make sense to redirect users to the docs ofremote_exec

@pablogsal
Copy link
Member

, so it would be simply shown in the traceback.

These are CLI tools, we shouldn't show traceback here but a nice friendly error message

@gaogaotiantian
Copy link
Member

We can show a message instead of traceback I have no problem with that. I really don't think we should have 50 lines of documentation pasted all over our code base. The detailed explanation should definitely live in the documentation somewhere. We should say something like "You don't have the permission to (retrieve data from?attach to?) another proces, for detailed information, seehttps://docs.python.org/...". For Unix users, that would directly translate to - try it withsudo and that's not too bad.

@pablogsal
Copy link
Member

We can show a message instead of traceback I have no problem with that. I really don't think we should have 50 lines of documentation pasted all over our code base. The detailed explanation should definitely live in the documentation somewhere. We should say something like "You don't have the permission to (retrieve data from?attach to?) another proces, for detailed information, seehttps://docs.python.org/...". For Unix users, that would directly translate to - try it withsudo and that's not too bad.

Alright let's out this in the docs somewhere thst makes sense and lets link to that from the error message. Would that work for you?

ivonastojanovic reacted with thumbs up emoji

@gaogaotiantian
Copy link
Member

Yes, that works for me.

Add OS-specific permission requirements under the remote debuggingattachment protocol section. Include guidance for Linux, macOS, andWindows to help users resolve common permission-related issues whenattaching to processes.
Add help text and display a URL in permission-related errors whenusing the -p option in pdb to assist users in resolving commonissues during remote debugging.
Print a URL with steps to resolve permission errors when inspectingprocesses using asyncio.tools.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kumaraditya303kumaraditya303kumaraditya303 left review comments

@gaogaotiantiangaogaotiantianAwaiting requested review from gaogaotiantiangaogaotiantian is a code owner

@1st11st1Awaiting requested review from 1st11st1 is a code owner

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov is a code owner

@willingcwillingcAwaiting requested review from willingcwillingc is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@ivonastojanovic@gaogaotiantian@pablogsal@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp