Skip to content

Commit

Permalink
version 0.1.9: commands not crashing if failing to cast stdout to path
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Berenz committed Oct 28, 2024
1 parent 1828d0e commit f38b76f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions nightskycam/utils/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import base64
import errno
import subprocess
import threading
from contextlib import contextmanager
Expand Down Expand Up @@ -291,9 +292,16 @@ def _inform_server(

stdout = result.stdout.strip()

if ftp_config and Path(stdout).is_file():
stdout_file: Optional[Path]
try:
stdout_file = Path(stdout)
except OSError as e:
# some strings can not be "cast" as path
stdout_file = None

if ftp_config and stdout_file.is_file():
with get_ftp(ftp_config, ftp_config.folder) as ftp:
uploaded_size = ftp.upload(Path(stdout), True)
uploaded_size = ftp.upload(stdout_file, True)
result.stdout = Path(stdout).name

message = serialize_command_result(result, token=token)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nightskycam"
version = "0.1.8"
version = "0.1.9"
description = "taking pictures at night"
authors = ["Vincent Berenz <vberenz@tuebingen.mpg.de>"]
packages = [{ include = "nightskycam" }]
Expand Down

0 comments on commit f38b76f

Please sign in to comment.