[MO] fix simplified MO import for PyCharm Debug (#9866)
* fix simplified MO import for PyCharm Debug * package_BOM update
This commit is contained in:
parent
e0af970d62
commit
9bb7697b2f
@ -1026,6 +1026,7 @@ openvino/tools/mo/subprocess_main.py
|
||||
openvino/tools/mo/utils/__init__.py
|
||||
openvino/tools/mo/utils/broadcasting.py
|
||||
openvino/tools/mo/utils/check_ie_bindings.py
|
||||
openvino/tools/mo/utils/check_mo_import.py
|
||||
openvino/tools/mo/utils/class_registration.py
|
||||
openvino/tools/mo/utils/cli_parser.py
|
||||
openvino/tools/mo/utils/custom_replacement_config.py
|
||||
|
@ -4,7 +4,6 @@
|
||||
import logging as log
|
||||
import os
|
||||
import subprocess
|
||||
from multiprocessing import Process, Queue
|
||||
import sys
|
||||
|
||||
|
||||
@ -38,8 +37,15 @@ def setup_env():
|
||||
mo_root_path = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir)
|
||||
|
||||
# Check that MO root directory already set to the PYTHONPATH
|
||||
status = subprocess.run([sys.executable, "-c", "try: import openvino.tools.mo \nexcept: exit(1)"], env=os.environ)
|
||||
if status.returncode != 0:
|
||||
def is_mo_imported():
|
||||
try:
|
||||
status = subprocess.run([sys.executable, os.path.join(mo_root_path, 'openvino/tools/mo/utils/check_mo_import.py')],
|
||||
env=os.environ)
|
||||
return status.returncode == 0
|
||||
except:
|
||||
return False
|
||||
|
||||
if not is_mo_imported():
|
||||
# If no, we try to set it manually based on relative path
|
||||
python_path_key = 'PYTHONPATH'
|
||||
if python_path_key not in os.environ:
|
||||
@ -49,8 +55,7 @@ def setup_env():
|
||||
|
||||
sys.path.append(mo_root_path)
|
||||
|
||||
status = subprocess.run([sys.executable, "-c", "try: import openvino.tools.mo \nexcept: exit(1)"], env=os.environ)
|
||||
if status.returncode != 0:
|
||||
if not is_mo_imported():
|
||||
log_mo_root_dir_not_found()
|
||||
sys.exit(1)
|
||||
|
||||
|
7
tools/mo/openvino/tools/mo/utils/check_mo_import.py
Normal file
7
tools/mo/openvino/tools/mo/utils/check_mo_import.py
Normal file
@ -0,0 +1,7 @@
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
try:
|
||||
import openvino.tools.mo
|
||||
except:
|
||||
exit(1)
|
Loading…
Reference in New Issue
Block a user