Skip to content

Avoid crash when styles aren't available yet#97

Merged
davep merged 3 commits into
davep:mainfrom
zvonler-sfw:linux_vm_crash
May 20, 2026
Merged

Avoid crash when styles aren't available yet#97
davep merged 3 commits into
davep:mainfrom
zvonler-sfw:linux_vm_crash

Conversation

@zvonler-sfw

Copy link
Copy Markdown

Fixes a frequent but intermittent crash when using the dialogs in an emulated virtual machine. Discussion here #96

Please include this fix in a v0.6.1 release so that it can be picked up by systems still on Python 3.9.

@davep

davep commented May 20, 2026

Copy link
Copy Markdown
Owner

Please include this fix in a v0.6.1 release so that it can be picked up by systems still on Python 3.9.

I'm afraid I only maintain a "latest" release, not earlier releases. Also Python 3.9 has been EOL for about six months at this point and I prefer to only maintain for Python versions that are still supported.

@davep davep added the Bug Something isn't working label May 20, 2026
@davep
davep merged commit 1120eed into davep:main May 20, 2026
6 checks passed
@zvonler-sfw

Copy link
Copy Markdown
Author

Understood. In case anyone else runs into the problem, I'll include here how I'm monkey patching the library in my application as a workaround for Python 3.9:

from textual_fspicker.parts.directory_navigation import DirectoryNavigation, DirectoryEntryStyling
from rich.style import Style

def get_styles_checked(self) -> DirectoryEntryStyling:
    try:
        return DirectoryEntryStyling(
            self.get_component_rich_style("directory-navigation--hidden"),
            self.get_component_rich_style("directory-navigation--name", partial=True),
            self.get_component_rich_style("directory-navigation--size", partial=True),
            self.get_component_rich_style("directory-navigation--time", partial=True),
        )
    except KeyError:
        return DirectoryEntryStyling(Style(), Style(), Style(), Style())

DirectoryNavigation._styles = property(get_styles_checked)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants