Changeset b8c2c67


Ignore:
Timestamp:
May 16, 2020, 12:27:01 PM (7 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
d8a7ace
Parents:
592a561
Message:

rrdhandler accepts pathlib objects as database file path now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnuboat/common/datahandler/rrdhandler.py

    r592a561 rb8c2c67  
    1919import rrdtool
    2020import os
     21from pathlib import Path
    2122
    2223import gnuboat.common.datahandler.rrdschema as rrdschema
    … …  
    4445            )
    4546        ]
    46 
    47     if not os.path.isfile(database_file):
     47    if not isinstance(database_file, Path):
     48        database_file = Path(database_file)
     49    if not database_file.is_file():
    4850        rrdtool.create(
    4951            database_file, "--start", start_time, "--step", str(step),
    … …  
    5456def rrd_update(rrdfile, value_string):
    5557    try:
     58        if isinstance(rrdfile, Path):
     59            rrdfile = str(rrdfile.resolve())
    5660        rrdtool.update(rrdfile, value_string)
    5761    except Exception as e:
Note: See TracChangeset for help on using the changeset viewer.