Skip to content

Commit

Permalink
Fixed #3 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
geozeke authored Feb 19, 2025
1 parent 9d35919 commit 065dd1a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.2.7][0.2.7] - 2025-02-19

### Fixed

* \[BUG\] Fix crashing with unknown file types ([#3][issue3])

<!--------------------------------------------------------------------->

## [0.2.6][0.2.6] - 2025-02-15

### Changed
Expand Down Expand Up @@ -27,8 +35,10 @@ _Public Release._
_Beta Release._

[0.1.2]: https://github.com/geozeke/smvp/releases/tag/v0.1.2
[issue1]: https://github.com/geozeke/smvp/issues/1
[0.2.0]: https://github.com/geozeke/smvp/releases/tag/v0.2.0
[0.2.5]: https://github.com/geozeke/smvp/releases/tag/v0.2.5
[0.2.6]: https://github.com/geozeke/smvp/releases/tag/v0.2.6
[0.2.7]: https://github.com/geozeke/smvp/releases/tag/v0.2.7
[issue1]: https://github.com/geozeke/smvp/issues/1
[issue3]: https://github.com/geozeke/smvp/issues/3
[lxml]: https://lxml.de
36 changes: 13 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[project]
name = "smvp"
version = "0.2.6"
version = "0.2.7"
description = "Send a formatted email from the command line"
authors = [
{ name = "Peter Nardi", email = "[email protected]" }
]
license = {file = "LICENSE"}
readme = {file = "README.md", content-type = "text/markdown"}
authors = [{ name = "Peter Nardi", email = "[email protected]" }]
license = { file = "LICENSE" }
readme = { file = "README.md", content-type = "text/markdown" }
keywords = [
"ansi",
"cron",
Expand All @@ -28,35 +26,31 @@ classifiers = [
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Topic :: Utilities",
"Topic :: System :: Logging",
"Topic :: Text Processing :: Markup :: HTML",
"Topic :: System :: Logging",
"Topic :: Text Processing :: Markup :: HTML",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.13",
]

requires-python = ">=3.8"
dependencies = [
"ansi2html>=1.9.2",
"bs4>=0.0.2",
"lxml>=5.3.0",
"tomli>=1.1.0 ; python_full_version < '3.11'",
"ansi2html>=1.9.2",
"bs4>=0.0.2",
"lxml>=5.3.0",
"tomli>=1.1.0 ; python_full_version < '3.11'",
]

[project.urls]
"Source Code" = "https://github.com/geozeke/smvp"
"Bug Tracker" = "https://github.com/geozeke/smvp/issues"

[dependency-groups]
dev = [
"mypy>=1.14.1",
"ruff>=0.8.6",
"types-beautifulsoup4>=4.12.0.20241020",
]
dev = ["mypy>=1.14.1", "ruff>=0.8.6", "types-beautifulsoup4>=4.12.0.20241020"]
[project.scripts]
smvp = "smvp:main"

Expand All @@ -68,11 +62,7 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build]
exclude = [
".gitignore",
"Makefile",
"uv.lock",
]
exclude = [".gitignore", "Makefile", "uv.lock"]
# Add pyproject.toml to the final package so the version number can be
# extracted during runtime.
[tool.hatch.build.targets.wheel.force-include]
Expand Down
13 changes: 11 additions & 2 deletions src/smvp/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,17 @@ def task_runner(args: argparse.Namespace) -> None:
email_subject = args.subject
email_port = 587

with args.file as f:
text_in = f.read()
try:
with args.file as f:
text_in = f.read()
except UnicodeDecodeError:
msg=f"""
Unable to process: {args.file.name}
smvp can only process textfiles (including those with ANSI
escape sequences) or html files. No email sent.
"""
print_docstring(msg=msg)
sys.exit(1)

# Craft an HTML version compatible with Gmail. If it's not HTML,
# then filter it through ansi2html to scan for ANSI codes and turn
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 065dd1a

Please sign in to comment.