From 3140bce97d3415adf0c5e195421d4fec49152849 Mon Sep 17 00:00:00 2001 From: Olli-Pekka Heinisuo Date: Sat, 12 Aug 2017 16:24:58 +0300 Subject: [PATCH] update import behaviour --- cv2/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cv2/__init__.py b/cv2/__init__.py index 5edaefaa..74b5b896 100644 --- a/cv2/__init__.py +++ b/cv2/__init__.py @@ -1,8 +1,13 @@ import sys import os +import importlib -# FFMPEG dll is not found on Windows without this +# FFmpeg dll is not found on Windows without this os.environ["PATH"] += os.pathsep + os.path.dirname(os.path.realpath(__file__)) -from . import cv2 -sys.modules['cv2'] = cv2 +# make IDE's (PyCharm) autocompletion happy +from .cv2 import * + +# wildcard import above does not import "private" variables like __version__ +# this makes them available +globals().update(importlib.import_module('cv2.cv2').__dict__) \ No newline at end of file