You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When giving a filename to SizedRotatingLogger that contains multiple periods/dots in the filename (ex 2017_Jeep_Grand_Cherokee_3.6L_V6.log), it returns a ValueError
It appears that whatever function is checking the file extension is splitting on the . and selecting element 1. If this is so, it would be better to split and select element -1.
The file extension at the end of the filename string should be checked, not element 1.
Additional context
OS and version: Windows 10 (WSL)
Python version: v3.10.12
python-can version: v4.3.1
python-can interface/s (if applicable): can0/vcan0
Traceback and logs
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/applications.py", line 116, in __call__
await self.middleware_stack(scope, receive, send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/middleware/cors.py", line 91, in __call__
await self.simple_response(scope, receive, send, request_headers=headers)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/middleware/cors.py", line 146, in simple_response
await self.app(scope, receive, send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app
raise exc
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app
await app(scope, receive, sender)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/routing.py", line 746, in __call__
await route.handle(scope, receive, send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/routing.py", line 75, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app
raise exc
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app
await app(scope, receive, sender)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/starlette/routing.py", line 70, in app
response = await func(request)
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/fastapi/routing.py", line 299, in app
raise e
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/fastapi/routing.py", line 294, in app
raw_response = await run_endpoint_function(
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
File "/REDACTED_PATH/main.py", line 220, in recordCANBus
logger = cf.create_logger(filename=os.path.join(path, my_file))
File "/REDACTED_PATH/tools/can_funcs.py", line 36, in create_logger
logger = can.SizedRotatingLogger(base_filename=filename,
File "/REDACTED_PATH/venv/lib/python3.10/site-packages/can/io/logger.py", line 263, in _get_new_writer
raise ValueError(
ValueError: The log format ".6L_V6.log" is not supported by SizedRotatingLogger. SizedRotatingLogger supports the following formats: .log, .blf, .csv, .txt, .asc
Describe the bug
When giving a filename to SizedRotatingLogger that contains multiple periods/dots in the filename (ex 2017_Jeep_Grand_Cherokee_3.6L_V6.log), it returns a
ValueError
It appears that whatever function is checking the file extension is splitting on the
.
and selecting element1
. If this is so, it would be better to split and select element-1
.Example:
To Reproduce
Add more than one
.
in the filename.Expected behavior
The file extension at the end of the filename string should be checked, not element
1
.Additional context
OS and version: Windows 10 (WSL)
Python version: v3.10.12
python-can version: v4.3.1
python-can interface/s (if applicable): can0/vcan0
Traceback and logs
The text was updated successfully, but these errors were encountered: