juftin / browsr

🗂️ a pleasant file explorer in your terminal supporting all filesystems
http://juftin.com/browsr/
MIT License
225 stars 13 forks source link

"ValueError: Invalid format string" When opening file on windows #14

Closed Zakaria-ouertani closed 1 year ago

Zakaria-ouertani commented 1 year ago

image image image image

╭────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────────────────────────────╮
│ C:\Users\Administrator\.local\pipx\venvs\browsr\Lib\site-packages\textual\widget.py:2816 in render_lines                                                                                                      │
│                                                                                                                                                                                                               │
│   2813 │   │   Returns:                                                                         ╭─────────────────────── locals ────────────────────────╮                                                     │
│   2814 │   │   │   A list of list of segments.                                                  │ crop = Region(x=0, y=0, width=207, height=1)          │                                                     │
│   2815 │   │   """                                                                              │ self = CurrentFileInfoBar(pseudo_classes={'enabled'}) │                                                     │
│ ❱ 2816 │   │   strips = self._styles_cache.render_widget(self, crop)                            ╰───────────────────────────────────────────────────────╯                                                     │
│   2817 │   │   return strips                                                                                                                                                                                  │
│   2818 │                                                                                                                                                                                                      │
│   2819 │   def get_style_at(self, x: int, y: int) -> Style:                                                                                                                                                   │
│                                                                                                                                                                                                               │
│ C:\Users\Administrator\.local\pipx\venvs\browsr\Lib\site-packages\textual\_styles_cache.py:115 in render_widget                                                                                               │
│                                                                                                                                                                                                               │
│   112 │   │                                                                                    ╭─────────────────────────────────────────────── locals ───────────────────────────────────────────────╮       │
│   113 │   │   base_background, background = widget.background_colors                           │      background = Color(0, 66, 149)                                                                  │       │
│   114 │   │   styles = widget.styles                                                           │ base_background = Color(0, 66, 149)                                                                  │       │
│ ❱ 115 │   │   strips = self.render(                                                            │ border_subtitle = None                                                                               │       │
│   116 │   │   │   styles,                                                                      │    border_title = None                                                                               │       │
│   117 │   │   │   widget.region.size,                                                          │            crop = Region(x=0, y=0, width=207, height=1)                                              │       │
│   118 │   │   │   base_background,                                                             │            self = <textual._styles_cache.StylesCache object at 0x0000019798E4D010>                   │       │
│                                                                                                │          styles = RenderStyles(                                                                      │       │
│                                                                                                │                   │   display='block',                                                               │       │
│                                                                                                │                   │   width=Scalar(                                                                  │       │
│                                                                                                │                   │   │   value=100.0,                                                               │       │
│                                                                                                │                   │   │   unit=<Unit.WIDTH: 4>,                                                      │       │
│                                                                                                │                   │   │   percent_unit=<Unit.WIDTH: 4>                                               │       │
│                                                                                                │                   │   ),                                                                             │       │
│                                                                                                │                   │   scrollbar_color=Color(35, 86, 139),                                            │       │
│                                                                                                │                   │   scrollbar_color_hover=Color(35, 86, 139),                                      │       │
│                                                                                                │                   │   scrollbar_color_active=Color(231, 146, 13),                                    │       │
│                                                                                                │                   │   scrollbar_corner_color=Color(20, 25, 31),                                      │       │
│                                                                                                │                   │   scrollbar_background=Color(20, 25, 31),                                        │       │
│                                                                                                │                   │   scrollbar_background_hover=Color(0, 5, 15),                                    │       │
│                                                                                                │                   │   scrollbar_background_active=Color(0, 0, 0),                                    │       │
│                                                                                                │                   │   scrollbar_size_vertical=2,                                                     │       │
│                                                                                                │                   │   scrollbar_size_horizontal=1,                                                   │       │
│                                                                                                │                   │   link_color=Color(255, 255, 255, a=0.87),                                       │       │
│                                                                                                │                   │   auto_link_color=True,                                                          │       │
│                                                                                                │                   │   link_style=Style(underline=True),                                              │       │
│                                                                                                │                   │   link_hover_color=Color(255, 255, 255, a=0.87),                                 │       │
│                                                                                                │                   │   auto_link_hover_color=True,                                                    │       │
│                                                                                                │                   │   link_hover_background=Color(1, 120, 212),                                      │       │
│                                                                                                │                   │   link_hover_style=Style(bold=True, underline=False)                             │       │
│                                                                                                │                   )                                                                                  │       │
│                                                                                                │          widget = CurrentFileInfoBar(pseudo_classes={'enabled'})                                     │       │
│                                                                                                ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯       │
│                                                                                                                                                                                                               │
│ C:\Users\Administrator\.local\pipx\venvs\browsr\Lib\site-packages\textual\_styles_cache.py:211 in render                                                                                                      │
│                                                                                                                                                                                                               │
│   208 │   │   render_line = self.render_line                                                                                                                                                                  │
│   209 │   │   for y in crop.line_range:                                                                                                                                                                       │
│   210 │   │   │   if is_dirty(y) or y not in self._cache:                                                                                                                                                     │
│ ❱ 211 │   │   │   │   strip = render_line(                                                                                                                                                                    │
│   212 │   │   │   │   │   styles,                                                                                                                                                                             │
│   213 │   │   │   │   │   y,                                                                                                                                                                                  │
│   214 │   │   │   │   │   size,                                                                                                                                                                               │
│                                                                                                                                                                                                               │
│ ╭───────────────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────────────╮                                                                          │
│ │             _height = 1                                                                                                          │                                                                          │
│ │           add_strip = <built-in method append of list object at 0x0000019798E4DD00>                                              │                                                                          │
│ │          background = Color(0, 66, 149)                                                                                          │                                                                          │
│ │     base_background = Color(0, 66, 149)                                                                                          │                                                                          │
│ │     border_subtitle = None                                                                                                       │                                                                          │
│ │        border_title = None                                                                                                       │                                                                          │
│ │             console = <console width=209 ColorSystem.TRUECOLOR>                                                                  │                                                                          │
│ │        content_size = Size(width=207, height=1)                                                                                  │                                                                          │
│ │                crop = Region(x=0, y=0, width=207, height=1)                                                                      │                                                                          │
│ │             filters = []                                                                                                         │                                                                          │
│ │            is_dirty = <built-in method __contains__ of set object at 0x0000019798E3FD80>                                         │                                                                          │
│ │             padding = Spacing(top=0, right=0, bottom=0, left=0)                                                                  │                                                                          │
│ │ render_content_line = <bound method Widget.render_line of CurrentFileInfoBar(pseudo_classes={'enabled'})>                        │                                                                          │
│ │         render_line = <bound method StylesCache.render_line of <textual._styles_cache.StylesCache object at 0x0000019798E4D010>> │                                                                          │
│ │                self = <textual._styles_cache.StylesCache object at 0x0000019798E4D010>                                           │                                                                          │
│ │                size = Size(width=207, height=1)                                                                                  │                                                                          │
│ │              strips = []                                                                                                         │                                                                          │
│ │              styles = RenderStyles(                                                                                              │                                                                          │
│ │                       │   display='block',                                                                                       │                                                                          │
│ │                       │   width=Scalar(value=100.0, unit=<Unit.WIDTH: 4>, percent_unit=<Unit.WIDTH: 4>),                         │                                                                          │
│ │                       │   scrollbar_color=Color(35, 86, 139),                                                                    │                                                                          │
│ │                       │   scrollbar_color_hover=Color(35, 86, 139),                                                              │                                                                          │
│ │                       │   scrollbar_color_active=Color(231, 146, 13),                                                            │                                                                          │
│ │                       │   scrollbar_corner_color=Color(20, 25, 31),                                                              │                                                                          │
│ │                       │   scrollbar_background=Color(20, 25, 31),                                                                │                                                                          │
│ │                       │   scrollbar_background_hover=Color(0, 5, 15),                                                            │                                                                          │
│ │                       │   scrollbar_background_active=Color(0, 0, 0),                                                            │                                                                          │
│ │                       │   scrollbar_size_vertical=2,                                                                             │                                                                          │
│ │                       │   scrollbar_size_horizontal=1,                                                                           │                                                                          │
│ │                       │   link_color=Color(255, 255, 255, a=0.87),                                                               │                                                                          │
│ │                       │   auto_link_color=True,                                                                                  │                                                                          │
│ │                       │   link_style=Style(underline=True),                                                                      │                                                                          │
│ │                       │   link_hover_color=Color(255, 255, 255, a=0.87),                                                         │                                                                          │
│ │                       │   auto_link_hover_color=True,                                                                            │                                                                          │
│ │                       │   link_hover_background=Color(1, 120, 212),                                                              │                                                                          │
│ │                       │   link_hover_style=Style(bold=True, underline=False)                                                     │                                                                          │
│ │                       )                                                                                                          │                                                                          │
│ │               width = 207                                                                                                        │                                                                          │
│ │                   y = 0                                                                                                          │                                                                          │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                          │
│                                                                                                                                                                                                               │
│ C:\Users\Administrator\.local\pipx\venvs\browsr\Lib\site-packages\textual\_styles_cache.py:399 in render_line                                                                                                 │
│                                                                                                                                                                                                               │
│   396 │   │   │   # Content with border and padding (C)                                                                                                                                                       │
│   397 │   │   │   content_y = y - gutter.top                                                                                                                                                                  │
│   398 │   │   │   if content_y < content_height:                                                                                                                                                              │
│ ❱ 399 │   │   │   │   line = render_content_line(y - gutter.top)                                                                                                                                              │
│   400 │   │   │   │   line = line.adjust_cell_length(content_width)                                                                                                                                           │
│   401 │   │   │   else:                                                                                                                                                                                       │
│   402 │   │   │   │   line = [make_blank(content_width, inner)]                                                                                                                                               │
│                                                                                                                                                                                                               │
│ ╭─────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────╮                                                                              │
│ │           background = Color(0, 66, 149)                                                                                     │                                                                              │
│ │      base_background = Color(0, 66, 149)                                                                                     │                                                                              │
│ │        border_bottom = ''                                                                                                    │                                                                              │
│ │  border_bottom_color = Color(0, 255, 0)                                                                                      │                                                                              │
│ │          border_left = ''                                                                                                    │                                                                              │
│ │    border_left_color = Color(0, 255, 0)                                                                                      │                                                                              │
│ │         border_right = ''                                                                                                    │                                                                              │
│ │   border_right_color = Color(0, 255, 0)                                                                                      │                                                                              │
│ │      border_subtitle = None                                                                                                  │                                                                              │
│ │         border_title = None                                                                                                  │                                                                              │
│ │           border_top = ''                                                                                                    │                                                                              │
│ │     border_top_color = Color(0, 255, 0)                                                                                      │                                                                              │
│ │              console = <console width=209 ColorSystem.TRUECOLOR>                                                             │                                                                              │
│ │       content_height = 1                                                                                                     │                                                                              │
│ │         content_size = Size(width=207, height=1)                                                                             │                                                                              │
│ │        content_width = 207                                                                                                   │                                                                              │
│ │            content_y = 0                                                                                                     │                                                                              │
│ │           from_color = <bound method Style.from_color of <class 'rich.style.Style'>>                                         │                                                                              │
│ │               gutter = Spacing(top=0, right=0, bottom=0, left=0)                                                             │                                                                              │
│ │               height = 1                                                                                                     │                                                                              │
│ │                inner = Style(bgcolor=Color('#004295', ColorType.TRUECOLOR, triplet=ColorTriplet(red=0, green=66, blue=149))) │                                                                              │
│ │                outer = Style(bgcolor=Color('#004295', ColorType.TRUECOLOR, triplet=ColorTriplet(red=0, green=66, blue=149))) │                                                                              │
│ │       outline_bottom = ''                                                                                                    │                                                                              │
│ │ outline_bottom_color = Color(0, 255, 0)                                                                                      │                                                                              │
│ │         outline_left = ''                                                                                                    │                                                                              │
│ │   outline_left_color = Color(0, 255, 0)                                                                                      │                                                                              │
│ │        outline_right = ''                                                                                                    │                                                                              │
│ │  outline_right_color = Color(0, 255, 0)                                                                                      │                                                                              │
│ │          outline_top = ''                                                                                                    │                                                                              │
│ │    outline_top_color = Color(0, 255, 0)                                                                                      │                                                                              │
│ │           pad_bottom = 0                                                                                                     │                                                                              │
│ │             pad_left = 0                                                                                                     │                                                                              │
│ │            pad_right = 0                                                                                                     │                                                                              │
│ │              pad_top = 0                                                                                                     │                                                                              │
│ │              padding = Spacing(top=0, right=0, bottom=0, left=0)                                                             │                                                                              │
│ │                 post = <function StylesCache.render_line.<locals>.post at 0x000001979982AF20>                                │                                                                              │
│ │  render_content_line = <bound method Widget.render_line of CurrentFileInfoBar(pseudo_classes={'enabled'})>                   │                                                                              │
│ │                 self = <textual._styles_cache.StylesCache object at 0x0000019798E4D010>                                      │                                                                              │
│ │                 size = Size(width=207, height=1)                                                                             │                                                                              │
│ │               styles = RenderStyles(                                                                                         │                                                                              │
│ │                        │   display='block',                                                                                  │                                                                              │
│ │                        │   width=Scalar(value=100.0, unit=<Unit.WIDTH: 4>, percent_unit=<Unit.WIDTH: 4>),                    │                                                                              │
│ │                        │   scrollbar_color=Color(35, 86, 139),                                                               │                                                                              │
│ │                        │   scrollbar_color_hover=Color(35, 86, 139),                                                         │                                                                              │
│ │                        │   scrollbar_color_active=Color(231, 146, 13),                                                       │                                                                              │
│ │                        │   scrollbar_corner_color=Color(20, 25, 31),                                                         │                                                                              │
│ │                        │   scrollbar_background=Color(20, 25, 31),                                                           │                                                                              │
│ │                        │   scrollbar_background_hover=Color(0, 5, 15),                                                       │                                                                              │
│ │                        │   scrollbar_background_active=Color(0, 0, 0),                                                       │                                                                              │
│ │                        │   scrollbar_size_vertical=2,                                                                        │                                                                              │
│ │                        │   scrollbar_size_horizontal=1,                                                                      │                                                                              │
│ │                        │   link_color=Color(255, 255, 255, a=0.87),                                                          │                                                                              │
│ │                        │   auto_link_color=True,                                                                             │                                                                              │
│ │                        │   link_style=Style(underline=True),                                                                 │                                                                              │
│ │                        │   link_hover_color=Color(255, 255, 255, a=0.87),                                                    │                                                                              │
│ │                        │   auto_link_hover_color=True,                                                                       │                                                                              │
│ │                        │   link_hover_background=Color(1, 120, 212),                                                         │                                                                              │
│ │                        │   link_hover_style=Style(bold=True, underline=False)                                                │                                                                              │
│ │                        )                                                                                                     │                                                                              │
│ │                width = 207                                                                                                   │                                                                              │
│ │                    y = 0                                                                                                     │                                                                              │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                              │
│                                                                                                                                                                                                               │
│ C:\Users\Administrator\.local\pipx\venvs\browsr\Lib\site-packages\textual\widget.py:2800 in render_line                                                                                                       │
│                                                                                                                                                                                                               │
│   2797 │   │   │   A rendered line.                                                             ╭─────────────────────── locals ────────────────────────╮                                                     │
│   2798 │   │   """                                                                              │ self = CurrentFileInfoBar(pseudo_classes={'enabled'}) │                                                     │
│   2799 │   │   if self._dirty_regions:                                                          │    y = 0                                              │                                                     │
│ ❱ 2800 │   │   │   self._render_content()                                                       ╰───────────────────────────────────────────────────────╯                                                     │
│   2801 │   │   try:                                                                                                                                                                                           │
│   2802 │   │   │   line = self._render_cache.lines[y]                                                                                                                                                         │
│   2803 │   │   except IndexError:                                                                                                                                                                             │
│                                                                                                                                                                                                               │
│ C:\Users\Administrator\.local\pipx\venvs\browsr\Lib\site-packages\textual\widget.py:2758 in _render_content                                                                                                   │
│                                                                                                                                                                                                               │
│   2755 │   def _render_content(self) -> None:                                                   ╭──────────────────────── locals ─────────────────────────╮                                                   │
│   2756 │   │   """Render all lines."""                                                          │ height = 1                                              │                                                   │
│   2757 │   │   width, height = self.size                                                        │   self = CurrentFileInfoBar(pseudo_classes={'enabled'}) │                                                   │
│ ❱ 2758 │   │   renderable = self.render()                                                       │  width = 207                                            │                                                   │
│   2759 │   │   renderable = self.post_render(renderable)                                        ╰─────────────────────────────────────────────────────────╯                                                   │
│   2760 │   │   options = self._console.options.update_dimensions(width, height).update(                                                                                                                       │
│   2761 │   │   │   highlight=False                                                                                                                                                                            │
│                                                                                                                                                                                                               │
│ C:\Users\Administrator\.local\pipx\venvs\browsr\Lib\site-packages\browsr\_base.py:181 in render                                                                                                               │
│                                                                                                                                                                                                               │
│   178 │   │   │   return Text("")                                                              ╭──────────────────────────── locals ────────────────────────────╮                                             │
│   179 │   │   status_string = "🗄️️️   " + self._convert_size(self.file_info.size)                  │          self = CurrentFileInfoBar(pseudo_classes={'enabled'}) │
   │
│   180 │   │   if self.file_info.last_modified is not None:                                     │ status_string = '🗄️️️  6B'                                         │
   │
│ ❱ 181 │   │   │   modify_time = self.file_info.last_modified.strftime("%b, %-d %Y %I:%M %p")   ╰────────────────────────────────────────────────────────────────╯                                             │
│   182 │   │   │   status_string += "  📅  " + modify_time                                                                                                                                                     │
│   183 │   │   status_string += (                                                                                                                                                                              │
│   184 │   │   │   "  💾  "                                                                                                                                                                                    │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
juftin commented 1 year ago

Do you have a little extra output? I'm trying to see what self.file_info.last_modified is and can't see any of the traceback from the strftime frame.

juftin commented 1 year ago

No wait, I see the bug. Fix incoming now, I'll follow up once published in a few minutes. https://github.com/juftin/browsr/commit/74886622210ab64d448d12faa1f8d5bf92a90037

juftin commented 1 year ago

Okay, browsr v1.10.6 is live on PyPI. You should be able to upgrade and finally run browsr. Thank you so much for reporting these bugs

Zakaria-ouertani commented 1 year ago

Thank you so much for reporting these bugs

You're welcome It now works fine. Thank you