Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Getting an error when callingload more than once #2078

Closed
Labels
Milestone
@bendhayer

Description

@bendhayer

Environment

  • Pythonnet version: 3.0.1
  • Python version: 3.11.1
  • Operating System: Windows & Linux
  • .NET Runtime: net6.0, net7.0

Details

  • Describe what you were trying to get done.

I have 2 libraries that are packaging some C# code with pythonnet as a dependency so that they can be used from Python without issues. In both libraries I callload("coreclr") in the__init__.py. When a user try to load both libraries at the same time pythonnet throw an exception. It wasn't happening with pythonnet version 2 so I suspect that this is a bug of pythonnet version 3.

frompythonnetimportloadload("coreclr")load("coreclr")
  • If there was a crash, please include the traceback here.
Failedtoinitializepythonnet:System.InvalidOperationException:ThispropertymustbesetbeforeruntimeisinitializedatPython.Runtime.Runtime.set_PythonDLL(Stringvalue)in/tmp/build-via-sdist-dq4gmg3h/pythonnet-3.0.1/src/runtime/Runtime.cs:line27atPython.Runtime.Loader.Initialize(IntPtrdata,Int32size)in/tmp/build-via-sdist-dq4gmg3h/pythonnet-3.0.1/src/runtime/Loader.cs:line23atPython.Runtime.Runtime.set_PythonDLL(Stringvalue)in/tmp/build-via-sdist-dq4gmg3h/pythonnet-3.0.1/src/runtime/Runtime.cs:line27atPython.Runtime.Loader.Initialize(IntPtrdata,Int32size)in/tmp/build-via-sdist-dq4gmg3h/pythonnet-3.0.1/src/runtime/Loader.cs:line23Traceback (mostrecentcalllast):File"/home/gitlab-runner/test_pythonnet/test.py",line4,in<module>load("coreclr")File"/home/gitlab-runner/test_pythonnet/.venv/lib/python3.11/site-packages/pythonnet/__init__.py",line144,inloadraiseRuntimeError("Failed to initialize Python.Runtime.dll")RuntimeError:FailedtoinitializePython.Runtime.dll

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp