F
F
flessska2021-04-21 17:38:51
Bots
flessska, 2021-04-21 17:38:51

How to solve PermissionError: [Errno 13] Permission denied: '/proc/stat' !?

Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/psutil/_common.py", line 403, in wrapper
return cache[key]
KeyError: (('/proc',), frozenset())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib /python3.9/site-packages/psutil/_pslinux.py", line 302, in
set_scputimes_ntuple("/proc")
File "/data/data/com.termux/files/usr/lib/python3.9/site- packages/psutil/_common.py", line 405, in wrapper
ret = cache[key] = fun(*args, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/psutil/_pslinux.py", line 269, in set_scputimes_ntuple
with open_binary('%s/stat' % procfs_path) as f:
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/psutil/_common.py", line 711, in open_binary
return open(fname, "rb", ** kwargs)
PermissionError: [Errno 13] Permission denied: '/proc/stat'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yupiter7575, 2021-04-21
@yupiter7575

Close notepad or whatever you have where this file is open

A
alegzz, 2021-04-22
@alegzz

The program needs root rights. so you need to run as root:
sudo python <your program>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question