Skip to content

Error loading clr into non-root domain #53

Open
@vadimkatsman

Description

@vadimkatsman

Environment

  • Pythonnet version: 3.0.1
  • Python version: 3.10
  • Operating System: Windows Server 2019
  • .NET Runtime: .Net Framework 4.8

Details

  • Describe what you were trying to get done.

In order to configure a specific .Net configuration file, I had to run set_runtime prior of clr load.

import os
from pathlib import Path
config_file = r"...valid path...\sctlib.py.config"
config_path = Path(config_file)
from pythonnet import set_runtime
set_runtime("netfx", domain="sctlib_py", config_file=config_path)
#set_runtime("netfx", domain="sctlib_py")
import clr

The config file is valid as it is borrowed verbatim (with exception of renaming) from the working console application.

"import clr" statement never succeeded:

Same script running with default domain works without an issue (but of course, does not recognize the config file which I need to have to target proper .Net Framework)

  • If there was a crash, please include the traceback here.
Traceback (most recent call last):
  File "D:\_WorkRoot\Tests\Python_ASR\Diarization\_Examples\Enrichment\sctlib.py", line 9, in <module>
    import clr
  File "C:\Program Files\Python310\lib\site-packages\clr.py", line 6, in <module>
    load()
  File "C:\Program Files\Python310\lib\site-packages\pythonnet\__init__.py", line 143, in load
    if func(b"") != 0:
  File "C:\Program Files\Python310\lib\site-packages\clr_loader\types.py", line 64, in __call__
    return self._callable(ffi.cast("void*", buf_arr), len(buf_arr))
RuntimeError: cannot call null pointer pointer from cdata 'int(*)(void *, int)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions