-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Termux] PermissionError: [Errno 13] Permission denied: '/proc/stat' #2195
Comments
Please paste the full error here instead of opening two tickets. |
The error originates from here and occurs at import time. It's just printed, meaning it does not crash the app.
As for |
This part is now solved by #2196. The |
A bit off-topic, but when will 5.9.5 be released? |
@giampaolo in version |
So How to get rid of this annoying error each time i run the code ? |
@Ammar-Husain you can copy /proc/stat with adb and then read it (you will need to setup adb) /data/data/com.termux/files/usr/lib/python3.11/site-packages/psutil/_pslinux.py function def set_scputimes_ntuple(procfs_path): replace with open_binary('%s/stat' ... with os.system('adb shell cp /proc/stat /sdcard/stat') or just copy file once |
Thought I would linkback to pipx issue discussing the traceback being printed If The actual code that uses
would be nice to be able to silence the traceback without having to mess with |
I have fixed this in becbe86. The error/exception is no longer printed on screen. It is only shown by using |
works now, thanks a lot!! |
* 'master' of https://github.com/giampaolo/psutil: pre-release give CREDIT to @JeremyGrosser and @getsentry for sponsorship (thanks\!) fix error in test_contracts.py on win chore: update GHA workflows (giampaolo#2315) fix giampaolo#2195 / linux: no longer print exception at import time Add ruff Python linter, remove flake8 (giampaolo#2312) Add toml-sort linting tool for pyproject.toml (giampaolo#2311) new RTD config new RTD config new RTD config Fix giampaolo#2308, OpenBSD: Process.threads() always fail with AccessDenied. Win: fix OpenProcess not recognizing when proc is gone. refact assertProcessGone refact assertProcessGone Add RsT linter (giampaolo#2292) Make _raise_if_pid_reused() raise NSP only if pid has been reused. fix DEVGUIDE.rst PID reusage is not checked for different set methods (giampaolo#2291)
Summary
Description
From the error message above, 2 errors occured:
KeyError
(IDK why this appears)PermissionError
(because of SeLinux restrictions on Android)I want to focus on more about the second error. Because we never know which files are readable and which are not, we should handle exceptions raised by
open()
. We should add antry-except
clause catchingPermissionError
. Another solution that I propose is to check whether the file is readable first before actually reading it. Both have their pros and cons, but I prefer the latter solution.The text was updated successfully, but these errors were encountered: