-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Description
Using clr-loader 0.1.6 with pythonnet 3.0.0.dev1.
When running on 32 bit Windows, when my code calls:
config_path = get_coreclr(r'C:\MyApp.runtimeconfig.json')
It throws exception:
Traceback (most recent call last):
File "MyApp.py", line 10, in <module>
config_path = get_coreclr(r'C:\MyApp.runtimeconfig.json')
File "C:\Program Files\Python38-32\lib\site-packages\clr_loader\__init__.py", line 38, in get_coreclr
dotnet_root = find_dotnet_root()
File "C:\Program Files\Python38-32\lib\site-packages\clr_loader\util\find.py", line 19, in find_dotnet_root
dotnet_root = os.path.join(prog_files, "dotnet")
File "C:\Program Files\Python38-32\lib\ntpath.py", line 78, in join
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
This is because clr_loader/util/find.py tries to read environment variable "ProgramFiles(x86)" but it doesn't exist on 32 bit Windows:
def find_dotnet_root() -> str:
dotnet_root = os.environ.get("DOTNET_ROOT", None)
if dotnet_root is not None:
return dotnet_root
if sys.platform == "win32":
# On Windows, the host library is stored separately from dotnet.exe for x86
if sys.maxsize > 2 ** 32:
prog_files = os.environ.get("ProgramFiles")
else:
prog_files = os.environ.get("ProgramFiles(x86)") <--- doesn't exist on 32 bit Windows
dotnet_root = os.path.join(prog_files, "dotnet") <--- exception
Metadata
Metadata
Assignees
Labels
No labels