Skip to content

write_to_textfile: fails to overwrite file on windows #649

@johanvdw

Description

@johanvdw

On linux, write_to_textfile can overwrite an existing file.
However, this fails if we try this on windows:

"C:\...\dashboard\metrics.py", line 169, in write_metrics
write_to_textfile(outfile, registry)
File "C:\...\env\lib\site-packages\prometheus_client\exposition.py", line 275, in write_to_textfile
os.rename(tmppath, path)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: '..\metrics\cable_alert.prom.6092.3608' -> '..\metrics\cable_alert.prom'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions