Comment by theteapot
7 days ago
> to a raciness in load_json where it's checked for file existence with an if and then carrying on as if the file is certainly there...
It's not a race. It's just redundant. If the file does not exist at the time you actually try to access it you get the same error with slightly better error message.
There is a log message that won't be output in that case: whether getting a full, "native" FileNotFound exception is better is beside the point, since the goal of the code was obviously to print a custom error message.
And it's trivial to achieve the desired effect sanely:
It'd even be fewer lines of code.
Or even fewer by doing it in a global exception handler instead of every time you try to open a file, since all your doing is piping the error though logger.