Python Forum
Problems parsing /proc folder
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems parsing /proc folder
#1
I'm trying to make a code that searches for an integer inode in the /proc files of the form /proc/pid and returns what files have this integer. When I made the code I did not know /proc couldn't be parsed by normal means (my script returns Errno13 permission denied even with root enabled on qpython3) only now I know there is the pip package "proc" but I have not found much information about this package online and I don't know if it applies here.

Here is where my code freezes
fds = os.listdir ("/proc/%s/fd" % pid)
        for fd in fds:
            if ('socket:[%d]' % inode) == os.readlink ("/proc/%s/fd/%s" % (pid, fd)):
                print ("%s, " % pid)
when I try to create variable fds receiving the list of folders inside "/proc/pid/fd".Anyone knows how to fix it?
Reply


Messages In This Thread
Problems parsing /proc folder - by anddontyoucomebacknomore - Mar-06-2019, 04:35 PM
RE: Problems parsing /proc folder - by Larz60+ - Mar-06-2019, 08:08 PM
RE: Problems parsing /proc folder - by DeaD_EyE - Mar-06-2019, 09:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 465 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  Generate lists of devices and partitions from /proc/partitions? DachshundDigital 1 729 Feb-28-2023, 10:55 PM
Last Post: deanhystad
  Compare filename with folder name and copy matching files into a particular folder shantanu97 2 4,390 Dec-18-2021, 09:32 PM
Last Post: Larz60+
  Move file from one folder to another folder with timestamp added end of file shantanu97 0 2,432 Mar-22-2021, 10:59 AM
Last Post: shantanu97
  Python Cut/Copy paste file from folder to another folder rdDrp 4 4,938 Aug-19-2020, 12:40 PM
Last Post: rdDrp
  Encoding problems on multiple files in one folder NikolajKorsgaard 5 3,941 Jun-11-2019, 03:39 AM
Last Post: micseydel
  Visiting invisible folders in /proc anddontyoucomebacknomore 0 1,524 Mar-18-2019, 02:05 AM
Last Post: anddontyoucomebacknomore
  Delete directories in folder is not working after folder is updated asheru93 2 2,599 Feb-13-2019, 12:37 PM
Last Post: asheru93
  copy content of folder to existing folder shlomi27 0 2,612 Aug-11-2018, 01:44 PM
Last Post: shlomi27
  execute a SQL stored proc within PYTHON PYTHONDUDE 3 9,418 Mar-21-2018, 04:15 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020