Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_clr_path():
"""
Return path to .NET CLR binaries.
Use dotnetcore2 package if Python 3.x, otherwise look for libs bundled with
NimbusML.
"""
if six.PY2:
return get_mlnet_path()
else:
from dotnetcore2 import runtime as clr_runtime
libs_root = os.path.join(clr_runtime._get_bin_folder(), 'shared',
'Microsoft.NETCore.App')
# Search all libs folders to find which one contains the .NET CLR libs
libs_folders = os.listdir(libs_root)
if len(libs_folders) == 0:
raise ImportError("Trouble importing dotnetcore2: "
"{} had no libs folders.".format(libs_root))
clr_path = None
for folder in libs_folders:
if os.path.exists(os.path.join(libs_root, folder,
'Microsoft.CSharp.dll')):
clr_path = os.path.join(libs_root, folder)
break
if not clr_path:
raise ImportError(
"Trouble importing dotnetcore2: Microsoft.CSharp.dll was not "