hardbyte / hardbyte/python-can

How do I use TRC file version 1.1? default it's using 2.1.

未关闭
#1,600 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Python
星标
1.6k
派生
697
PR 合并指标
30 天内没有已合并 PR

描述

### Describe the bug
If i modify my code to use
```
logger = TRCWriter(f'{folder_path}_can_log_{now}.trc', file_version=TRCFileVersion.V1_1)
```
i get an error. I suppose I am calling the version incorrectly or it might be a bug.

### To Reproduce
This is what my current code looks like, which is running fine.
```# Create a logger object with the filename and any otherarguments
def create_logger():
now = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
logger = TRCWriter(f'{folder_path}_can_log_{now}.trc')
return logger

def log_can_messages(): # define a function for logging
try:
logger = create_logger() # create a new logger
start_time = time.time() # record the start time
for msg in can_bus: # or rename can_bus to bus
logger.on_message_received(msg)
#print(msg)
elapsed_time = time.time() - start_time # check the elapsed time
if elapsed_time >= 60: # if 1 minutes have passed
logger.stop() # stop the current logger
logger = create_logger() # create a new logger
start_time = time.time() # reset the start time
finally:
logger.stop()
```

### Expected behavior

### Additional context

OS and version: Windows 10
Python version: 3.11.1
python-can version: 4.2.1
python-can interface/s (if applicable): PCAN

Traceback and logs

```python
def func():
return "hello, world!"
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。