pycritty icon indicating copy to clipboard operation
pycritty copied to clipboard

BUG: FileNotFoundError

Open Junyi-99 opened this issue 1 year ago • 3 comments

Cannot touch a file before create the folder, so it should create a folder first then touch the file.

Screenshot 2023-08-15 at 6 33 16 PM

Junyi-99 avatar Aug 15 '23 10:08 Junyi-99

Interesting, does this happen on Mac only? The .config/pycritty directory should be created when installing the package with pip install (see here) but I guess the code should check that again at runtime. I'll take a look when I have time, meanwhile if you want to submit a PR here are some ideas:

  • In the main function, check if resources.pycritty_dir exists before doing anything, if it doesn't terminate the program with a log.error message.
  • Same as before but instead of terminating the program, create the directory, log a warning and continue.
  • Third option, change the get_or_create_method to create all the parent directories if they don't exist. It could be changed in the Resource class or maybe overriden in the ConfigFile, it should create the parent directory then call the parent class method to create the file.

antoniosarosi avatar Aug 15 '23 12:08 antoniosarosi

The bug was found on my Intel Mac, but I also reproduced this problem on a m1 Mac, see this picture:

image

The folder was not created.

Junyi-99 avatar Aug 16 '23 10:08 Junyi-99

But when I try to install the package manually it creates a folder

image

Junyi-99 avatar Aug 16 '23 10:08 Junyi-99