mirror of
https://github.com/opencv/opencv.git
synced 2025-06-17 15:20:51 +08:00
python: restore sys.path in bootstrap()
- multiprocessing need to start from bootstrap code - loading may fail due to missing os.add_dll_directory() calls
This commit is contained in:
parent
f4f462c50b
commit
36d771affc
@ -18,6 +18,10 @@ except ImportError:
|
|||||||
|
|
||||||
def bootstrap():
|
def bootstrap():
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import copy
|
||||||
|
save_sys_path = copy.copy(sys.path)
|
||||||
|
|
||||||
if hasattr(sys, 'OpenCV_LOADER'):
|
if hasattr(sys, 'OpenCV_LOADER'):
|
||||||
print(sys.path)
|
print(sys.path)
|
||||||
raise ImportError('ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation.')
|
raise ImportError('ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation.')
|
||||||
@ -85,6 +89,8 @@ def bootstrap():
|
|||||||
del sys.modules['cv2']
|
del sys.modules['cv2']
|
||||||
import cv2
|
import cv2
|
||||||
|
|
||||||
|
sys.path = save_sys_path # multiprocessing should start from bootstrap code (https://github.com/opencv/opencv/issues/18502)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import sys
|
import sys
|
||||||
del sys.OpenCV_LOADER
|
del sys.OpenCV_LOADER
|
||||||
|
Loading…
Reference in New Issue
Block a user