nschloe / tiptop

:desktop_computer: Command-line system monitoring
MIT License
1.77k stars 70 forks source link

Test the aplication and I've got Errors #71

Closed hhlp closed 2 years ago

hhlp commented 2 years ago

My machine:

OS: Fedora release 35 (Thirty Five) Host: MS-7D54 1.0 Kernel: 5.16.12-200.fc35.x86_64 Shell: zsh 5.8.1 DE: GNOME 41.4 WM: Mutter Terminal: tilix CPU: AMD Ryzen 9 5900X (24) @ 3.700GHz GPU: NVIDIA GeForce GT 730 Memory: 32078MiB 2 SSD 1.- nvme and 2.- normal SSD card 1 SATA 4TB Memory: 32078MiB

Regards.,

This is what I've Got:

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/tiptop/_disk.py:49 in         │
│ on_mount                                                                     │
│                                                                              │
│    46 │   │   │   for item in psutil.disk_partitions()                       │
│    47 │   │   │   if not item.device.startswith("/dev/loop")                 │
│    48 │   │   ]                                                              │
│ ❱  49 │   │   self.total = [                                                 │
│    50 │   │   │   sizeof_fmt(psutil.disk_usage(mp).total, fmt=".1f")         │
│    51 │   │   │   for mp in self.mountpoints                                 │
│    52 │   │   ]                                                              │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
│ /home/hhlp/.local/lib/python3.10/site-packages/tiptop/_disk.py:50 in         │
│ <listcomp>                                                                   │
│                                                                              │
│    47 │   │   │   if not item.device.startswith("/dev/loop")                 │
│    48 │   │   ]                                                              │
│    49 │   │   self.total = [                                                 │
│ ❱  50 │   │   │   sizeof_fmt(psutil.disk_usage(mp).total, fmt=".1f")         │
│    51 │   │   │   for mp in self.mountpoints                                 │
│    52 │   │   ]                                                              │
│    53                                                                        │
│                                                                              │
│ ╭─────────────────── locals ────────────────────╮                            │
│ │ .0 = <list_iterator object at 0x7f7cc094e5f0> │                            │
│ │ mp = '/var/lib/docker/btrfs'                  │                            │
│ ╰───────────────────────────────────────────────╯                            │
│                                                                              │
│ /usr/lib64/python3.10/site-packages/psutil/__init__.py:1995 in disk_usage    │
│                                                                              │
│   1992 │   namedtuple including total, used and free space expressed in byte │
│   1993 │   plus the percentage usage.                                        │
│   1994 │   """                                                               │
│ ❱ 1995 │   return _psplatform.disk_usage(path)                               │
│   1996                                                                       │
│   1997                                                                       │
│   1998 def disk_partitions(all=False):                                       │
│                                                                              │
│ ╭──────────── locals ────────────╮                                           │
│ │ path = '/var/lib/docker/btrfs' │                                           │
│ ╰────────────────────────────────╯                                           │
│                                                                              │
│ /usr/lib64/python3.10/site-packages/psutil/_psposix.py:169 in disk_usage     │
│                                                                              │
│   166 │   the "free" and "used percent" user disk space.                     │
│   167 │   """                                                                │
│   168 │   if PY3:                                                            │
│ ❱ 169 │   │   st = os.statvfs(path)                                          │
│   170 │   else:  # pragma: no cover                                          │
│   171 │   │   # os.statvfs() does not support unicode on Python 2:           │
│   172 │   │   # - https://github.com/giampaolo/psutil/issues/416             │
│                                                                              │
│ ╭──────────── locals ────────────╮                                           │
│ │ path = '/var/lib/docker/btrfs' │                                           │
│ ╰────────────────────────────────╯                                           │
╰──────────────────────────────────────────────────────────────────────────────╯
PermissionError: [Errno 13] Permission denied: '/var/lib/docker/btrfs'
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:202 in      │
│ _get_lines                                                                   │
│                                                                              │
│   199 │   def _get_lines(self) -> Lines:                                     │
│   200 │   │   """Get segment lines to render the widget."""                  │
│   201 │   │   if self.render_cache is None:                                  │
│ ❱ 202 │   │   │   self.render_lines()                                        │
│   203 │   │   assert self.render_cache is not None                           │
│   204 │   │   lines = self.render_cache.lines                                │
│   205 │   │   return lines                                                   │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:188 in      │
│ render_lines                                                                 │
│                                                                              │
│   185 │                                                                      │
│   186 │   def render_lines(self) -> None:                                    │
│   187 │   │   width, height = self.size                                      │
│ ❱ 188 │   │   renderable = self.render_styled()                              │
│   189 │   │   options = self.console.options.update_dimensions(width, height │
│   190 │   │   lines = self.console.render_lines(renderable, options)         │
│   191 │   │   self.render_cache = RenderCache(self.size, lines)              │
│                                                                              │
│ ╭─────────── locals ───────────╮                                             │
│ │ height = 8                   │                                             │
│ │   self = Disk(name='Disk#1') │                                             │
│ │  width = 31                  │                                             │
│ ╰──────────────────────────────╯                                             │
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:128 in      │
│ render_styled                                                                │
│                                                                              │
│   125 │   │   Returns:                                                       │
│   126 │   │   │   RenderableType: A new renderable.                          │
│   127 │   │   """                                                            │
│ ❱ 128 │   │   renderable = self.render()                                     │
│   129 │   │   if self.padding is not None:                                   │
│   130 │   │   │   renderable = Padding(renderable, self.padding)             │
│   131 │   │   if self.border in self.BOX_MAP:                                │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/tiptop/_disk.py:159 in render │
│                                                                              │
│   156 │   │   self.refresh()                                                 │
│   157 │                                                                      │
│   158 │   def render(self):                                                  │
│ ❱ 159 │   │   return self.panel                                              │
│   160 │                                                                      │
│   161 │   async def on_resize(self, event):                                  │
│   162 │   │   self.read_stream.reset_width(event.width - 25)                 │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
╰──────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Disk' object has no attribute 'panel'
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:202 in      │
│ _get_lines                                                                   │
│                                                                              │
│   199 │   def _get_lines(self) -> Lines:                                     │
│   200 │   │   """Get segment lines to render the widget."""                  │
│   201 │   │   if self.render_cache is None:                                  │
│ ❱ 202 │   │   │   self.render_lines()                                        │
│   203 │   │   assert self.render_cache is not None                           │
│   204 │   │   lines = self.render_cache.lines                                │
│   205 │   │   return lines                                                   │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:188 in      │
│ render_lines                                                                 │
│                                                                              │
│   185 │                                                                      │
│   186 │   def render_lines(self) -> None:                                    │
│   187 │   │   width, height = self.size                                      │
│ ❱ 188 │   │   renderable = self.render_styled()                              │
│   189 │   │   options = self.console.options.update_dimensions(width, height │
│   190 │   │   lines = self.console.render_lines(renderable, options)         │
│   191 │   │   self.render_cache = RenderCache(self.size, lines)              │
│                                                                              │
│ ╭─────────── locals ───────────╮                                             │
│ │ height = 8                   │                                             │
│ │   self = Disk(name='Disk#1') │                                             │
│ │  width = 31                  │                                             │
│ ╰──────────────────────────────╯                                             │
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:128 in      │
│ render_styled                                                                │
│                                                                              │
│   125 │   │   Returns:                                                       │
│   126 │   │   │   RenderableType: A new renderable.                          │
│   127 │   │   """                                                            │
│ ❱ 128 │   │   renderable = self.render()                                     │
│   129 │   │   if self.padding is not None:                                   │
│   130 │   │   │   renderable = Padding(renderable, self.padding)             │
│   131 │   │   if self.border in self.BOX_MAP:                                │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/tiptop/_disk.py:159 in render │
│                                                                              │
│   156 │   │   self.refresh()                                                 │
│   157 │                                                                      │
│   158 │   def render(self):                                                  │
│ ❱ 159 │   │   return self.panel                                              │
│   160 │                                                                      │
│   161 │   async def on_resize(self, event):                                  │
│   162 │   │   self.read_stream.reset_width(event.width - 25)                 │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
╰──────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Disk' object has no attribute 'panel'
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:202 in      │
│ _get_lines                                                                   │
│                                                                              │
│   199 │   def _get_lines(self) -> Lines:                                     │
│   200 │   │   """Get segment lines to render the widget."""                  │
│   201 │   │   if self.render_cache is None:                                  │
│ ❱ 202 │   │   │   self.render_lines()                                        │
│   203 │   │   assert self.render_cache is not None                           │
│   204 │   │   lines = self.render_cache.lines                                │
│   205 │   │   return lines                                                   │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:188 in      │
│ render_lines                                                                 │
│                                                                              │
│   185 │                                                                      │
│   186 │   def render_lines(self) -> None:                                    │
│   187 │   │   width, height = self.size                                      │
│ ❱ 188 │   │   renderable = self.render_styled()                              │
│   189 │   │   options = self.console.options.update_dimensions(width, height │
│   190 │   │   lines = self.console.render_lines(renderable, options)         │
│   191 │   │   self.render_cache = RenderCache(self.size, lines)              │
│                                                                              │
│ ╭─────────── locals ───────────╮                                             │
│ │ height = 8                   │                                             │
│ │   self = Disk(name='Disk#1') │                                             │
│ │  width = 31                  │                                             │
│ ╰──────────────────────────────╯                                             │
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/textual/widget.py:128 in      │
│ render_styled                                                                │
│                                                                              │
│   125 │   │   Returns:                                                       │
│   126 │   │   │   RenderableType: A new renderable.                          │
│   127 │   │   """                                                            │
│ ❱ 128 │   │   renderable = self.render()                                     │
│   129 │   │   if self.padding is not None:                                   │
│   130 │   │   │   renderable = Padding(renderable, self.padding)             │
│   131 │   │   if self.border in self.BOX_MAP:                                │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
│                                                                              │
│ /home/hhlp/.local/lib/python3.10/site-packages/tiptop/_disk.py:159 in render │
│                                                                              │
│   156 │   │   self.refresh()                                                 │
│   157 │                                                                      │
│   158 │   def render(self):                                                  │
│ ❱ 159 │   │   return self.panel                                              │
│   160 │                                                                      │
│   161 │   async def on_resize(self, event):                                  │
│   162 │   │   self.read_stream.reset_width(event.width - 25)                 │
│                                                                              │
│ ╭────────── locals ──────────╮                                               │
│ │ self = Disk(name='Disk#1') │                                               │
│ ╰────────────────────────────╯                                               │
╰──────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Disk' object has no attribute 'panel'
pfmoore commented 2 years ago

I got the same, on Windows 11.

nschloe commented 2 years ago

Could you tell me the output of

import psutil
print([
    item.mountpoint
    for item in psutil.disk_partitions()
    if not item.device.startswith("/dev/loop")
])

on your machine?

pfmoore commented 2 years ago
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> print([
...     item.mountpoint
...     for item in psutil.disk_partitions()
...     if not item.device.startswith("/dev/loop")
... ])
['C:\\', 'D:\\', 'F:\\', 'H:\\', 'I:\\', 'J:\\', 'K:\\']
nschloe commented 2 years ago

This looks good. How about

psutil.disk_usage("C:\\").total

? (Perhaps also check the other drives.)

pfmoore commented 2 years ago

H to K give

>>> psutil.disk_usage("H:\\").total
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Gustav\.local\pipx\venvs\tiptop\lib\site-packages\psutil\__init__.py", line 2003, in disk_usage
    return _psplatform.disk_usage(path)
  File "C:\Users\Gustav\.local\pipx\venvs\tiptop\lib\site-packages\psutil\_pswindows.py", line 274, in disk_usage
    total, free = cext.disk_usage(path)
PermissionError: [WinError 21] The device is not ready: 'H'

Those four are slots on a USB card reader that don't have cards in them, so "not ready" is the correct result, I'd say.

nschloe commented 2 years ago

Could you update to 0.2.2 and try again please?

hhlp commented 2 years ago

Could you tell me the output of

import psutil
print([
    item.mountpoint
    for item in psutil.disk_partitions()
    if not item.device.startswith("/dev/loop")
])

on your machine?

This is mine:

Python 3.10.2 (main, Jan 17 2022, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> print([
... item.mountpoint
... for item in psutil.disk_partitions()
... if not item.device.startswith("/dev/loop")
... ])
['/', '/boot', '/home', '/boot/efi', '/mnt/WD_1', '/var/lib/docker/btrfs', '/run/media/hhlp/My Book']
>>> 

regards.,

nschloe commented 2 years ago

@hhlp Could you also try the latest version, and, if it still fails, repeat the steps I outlined above?

pfmoore commented 2 years ago

Works for me now - thanks for the amazingly fast turnaround!

nschloe commented 2 years ago

Cool. Let's close this then.

hhlp commented 2 years ago

Works for me too.....

Regards.,