Update __init__.py to support symbolic links
authorCSBVision <bjoern.boeken@csb.com>
Wed, 14 Apr 2021 10:05:53 +0000 (12:05 +0200)
committerCSBVision <bjoern.boeken@csb.com>
Wed, 14 Apr 2021 16:13:45 +0000 (16:13 +0000)
commitec32061f5fc63880727b2d252294412b2e024c54
treee707fdf1e6567e784eae3bb30107f745f30e7d21
parent6f70b0524af80f0e82b5daf8fa23fcaf73071c82
Update __init__.py to support symbolic links

Currently, the LOADER_DIR is set as os.path.dirname(os.path.abspath(__file__)). This does not point to the true library path if the cv2 folder is symlinked into the Python package directory such that importing cv2 under Python fails. The proposed change only resolves symbolic links correctly by calling os.path.realpath(__file__) first and does not change anything if __file__ contains no symbolic link.
modules/python/package/cv2/__init__.py