Skip to content

Unhandled PermissionError for /proc/stat via psutil #4357

@luckyabsoluter

Description

@luckyabsoluter

I'm encountering a PermissionError when running SeleniumBase v4.49.3 in a Termux android

The issue originates from psutil attempting to read /proc/stat, which is restricted by SELinux policies in this specific environment. SeleniumBase currently crashes because it doesn't catch the PermissionError (giampaolo/psutil#2195). The psutil maintainer clarified there that apps must handle this exception.

Suggested Solution:
Since we cannot guarantee access to /proc/stat across all environments (especially mobile terminals like Termux), calls to psutil that read restricted system files should be wrapped in a try-except block. Catching PermissionError and gracefully falling back or ignoring the stat retrieval would prevent the entire script from crashing.

Caused by:

Note: Since native tools like top work fine in Termux, it isn't entirely impossible on Android. There is still room for improvement within psutil itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeexternalOutside SeleniumBase's scope. / Ask somewhere else.feature/fix already existsUpgrade to the latest version as needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions