Skip to content

Commit

Permalink
Catch OSError when source code is not available (#2469)
Browse files Browse the repository at this point in the history
* Catch OSError when source code is not available

* update changelog with reference to fixed bug
  • Loading branch information
williballenthin authored May 8, 2023
1 parent 819b2f1 commit 483aa54
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `scrollbar-size` https://github.com/Textualize/textual/issues/2420
- 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

Expand Down
2 changes: 1 addition & 1 deletion src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ async def _process_messages(
app_css_path = (
f"{inspect.getfile(self.__class__)}:{self.__class__.__name__}"
)
except TypeError:
except (TypeError, OSError):
app_css_path = f"{self.__class__.__name__}"
self.stylesheet.add_source(
self.CSS, path=app_css_path, is_default_css=False
Expand Down
2 changes: 1 addition & 1 deletion src/textual/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def get_path(base: Type[DOMNode]) -> str:
"""Get a path to the DOM Node"""
try:
return f"{getfile(base)}:{base.__name__}"
except TypeError:
except (TypeError, OSError):
return f"{base.__name__}"

for tie_breaker, base in enumerate(self._node_bases):
Expand Down

0 comments on commit 483aa54

Please sign in to comment.