File not found error (a file located on WSL) on python platform

29 Views Asked by At

I'm working on Odoo project, and it's located on wsl of my windows OS, so when I build the project and go to specific route, it gives me an error like:

\\wsl$\ubuntu-20.04\home\abdulghani\odoo_community\odoo17\addons\auth_ldap\README.rst

But when I put this path on windows explorer it gives me a correct location and open the file, so how python handle absolute paths when building the project

The error is located here:

 if normalized_path.startswith('addons' + os.sep):
        normalized_path = normalized_path[7:]

    for addons_dir in addons_paths:
        # final path sep required to avoid partial match
        parent_path = os.path.normpath(os.path.normcase(addons_dir)) + os.sep
        fpath = (normalized_path if is_abs else
                 os.path.normpath(os.path.normcase(os.path.join(parent_path, normalized_path))))
        if fpath.startswith(parent_path) and os.path.exists(fpath):
            return fpath

    raise FileNotFoundError("File not found: " + file_path)
0

There are 0 best solutions below