Catch OSError when source code is not available (#2469)

* Catch OSError when source code is not available

* update changelog with reference to fixed bug
This commit is contained in:
Willi Ballenthin
2023-05-08 11:45:56 +02:00
committed by GitHub
parent 819b2f1eb3
commit 483aa54bd6
3 changed files with 3 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed `!important` not applying to `overflow` https://github.com/Textualize/textual/issues/2420 - Fixed `!important` not applying to `overflow` https://github.com/Textualize/textual/issues/2420
- Fixed `!important` not applying to `scrollbar-size` https://github.com/Textualize/textual/issues/2420 - Fixed `!important` not applying to `scrollbar-size` https://github.com/Textualize/textual/issues/2420
- Fixed `outline-right` not being recognised https://github.com/Textualize/textual/issues/2446 - Fixed `outline-right` not being recognised https://github.com/Textualize/textual/issues/2446
- Fixed OSError when a file system is not available https://github.com/Textualize/textual/issues/2468
### Changed ### Changed

View File

@@ -1660,7 +1660,7 @@ class App(Generic[ReturnType], DOMNode):
app_css_path = ( app_css_path = (
f"{inspect.getfile(self.__class__)}:{self.__class__.__name__}" f"{inspect.getfile(self.__class__)}:{self.__class__.__name__}"
) )
except TypeError: except (TypeError, OSError):
app_css_path = f"{self.__class__.__name__}" app_css_path = f"{self.__class__.__name__}"
self.stylesheet.add_source( self.stylesheet.add_source(
self.CSS, path=app_css_path, is_default_css=False self.CSS, path=app_css_path, is_default_css=False

View File

@@ -418,7 +418,7 @@ class DOMNode(MessagePump):
"""Get a path to the DOM Node""" """Get a path to the DOM Node"""
try: try:
return f"{getfile(base)}:{base.__name__}" return f"{getfile(base)}:{base.__name__}"
except TypeError: except (TypeError, OSError):
return f"{base.__name__}" return f"{base.__name__}"
for tie_breaker, base in enumerate(self._node_bases): for tie_breaker, base in enumerate(self._node_bases):