Skip to content

Theme Editor crashes when using vim #401

@orzel

Description

@orzel

When using vim and saving the file, the python code freaks out and the theme editor window dissapears.

27/11/2023 14:13:34 [DEBUG] The theme file has been updated, the preview window will refresh
Traceback (most recent call last):
  File "/home/orzel/clones/turing-smart-screen-python/theme-editor.py", line 263, in <module>
    if os.path.getmtime(theme_file) > last_edit_time:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 55, in getmtime
FileNotFoundError: [Errno 2] File o directory non esistente: 'res/themes/test/theme.yaml'

I'm not sure about the details, but I think vim handles filesaving differently than other editors. It uses rename instead of overwritting.

I use the following change, which works, but might be considered a hack, or too quick & dirty, I'll let you decide:

if os.path.exists(theme_file) and os.path.getmtime(theme_file) > last_edit_time:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions