[Errno 2] No such file or directory

Fixing a mistake FileNotFoundError: [Errno 2] No such file or directory

Usually the error occurs on a remote server, while local development is not a problem. In order to fix it, we explicitly indicate the paths in this way:

import os
this_dir = ospathdirname(ospathabspath(__file__))
file = ospathjoin(this_dir, ‘file_name’)

Similar Posts

Leave a Reply Cancel reply