-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Unhandled PermissionError for /proc/stat via psutil #4357
Copy link
Copy link
Closed
Labels
UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeexternalOutside SeleniumBase's scope. / Ask somewhere else.Outside SeleniumBase's scope. / Ask somewhere else.feature/fix already existsUpgrade to the latest version as neededUpgrade to the latest version as needed
Metadata
Metadata
Assignees
Labels
UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeexternalOutside SeleniumBase's scope. / Ask somewhere else.Outside SeleniumBase's scope. / Ask somewhere else.feature/fix already existsUpgrade to the latest version as neededUpgrade to the latest version as needed
Type
Fields
Give feedbackNo fields configured for issues without a type.
I'm encountering a
PermissionErrorwhen running SeleniumBase v4.49.3 in a Termux androidThe issue originates from
psutilattempting to read/proc/stat, which is restricted by SELinux policies in this specific environment. SeleniumBase currently crashes because it doesn't catch thePermissionError(giampaolo/psutil#2195). Thepsutilmaintainer clarified there that apps must handle this exception.Suggested Solution:
Since we cannot guarantee access to
/proc/statacross all environments (especially mobile terminals like Termux), calls topsutilthat read restricted system files should be wrapped in atry-exceptblock. CatchingPermissionErrorand gracefully falling back or ignoring the stat retrieval would prevent the entire script from crashing.Caused by:
Note: Since native tools like
topwork fine in Termux, it isn't entirely impossible on Android. There is still room for improvement withinpsutilitself.