steamship-core/python-client

dev_logging_handler creates invalid name for logfile in Windows

Closed this issue · 1 comments

Newest version crashes on Windows because the log file name contains ":" characters, python error:

File "C:\Code\python\steamship\multimodal-agent-starter-main\src\api.py", line 52, in <module> AgentREPL( File "C:\Code\python\steamship\multimodal-agent-starter-main\venv310\lib\site-packages\steamship\utils\repl.py", line 159, in __init__ super().__init__(**kwargs) File "C:\Code\python\steamship\multimodal-agent-starter-main\venv310\lib\site-packages\steamship\utils\repl.py", line 38, in __init__ self.dev_logging_handler = DevelopmentLoggingHandler.init_and_take_root() File "C:\Code\python\steamship\multimodal-agent-starter-main\venv310\lib\site-packages\steamship\invocable\dev_logging_handler.py", line 66, in init_and_take_root dev_logging_handler = DevelopmentLoggingHandler() File "C:\Code\python\steamship\multimodal-agent-starter-main\venv310\lib\site-packages\steamship\invocable\dev_logging_handler.py", line 59, in __init__ self.file_handler = logging.FileHandler(self.log_filename) File "C:\python310\lib\logging\__init__.py", line 1169, in __init__ StreamHandler.__init__(self, self._open()) File "C:\python310\lib\logging\__init__.py", line 1201, in _open return open_func(self.baseFilename, self.mode, OSError: [Errno 22] Invalid argument: 'C:\\Code\\python\\steamship\\multimodal-agent-starter-main\\logs\\shiplog--2023-07-16--10:32:09.log'

If I change the line 49 in "dev_logging_handler.py" to timestr = time.strftime("shiplog--%Y-%m-%d--%H-%M-%S.log") the log file is created successfully and steamship runs without errors.

Also added default utf-8 encoding to line 59 to support emojis in Windows.
self.file_handler = logging.FileHandler(self.log_filename,encoding="utf-8")