Visitar URL original
Unhandled exception. System.InvalidOperationException: GIL must always be released · Issue #2544 · pythonnet/pythonnet · GitHub
Skip to content

Unhandled exception. System.InvalidOperationException: GIL must always be released #2544

Description

@tarunsk1998

I have an dotnet application that uses pythonnet to invoke a python script.

I am facing the below issue while I am testing the application.

Error:
Unhandled exception. System.InvalidOperationException: GIL must always be released, and it must be released from the same thread that acquired it.
at Python.Runtime.Py.GILState.Finalize()

There is another error printing in the logs:
error message: The type initializer for 'Delegates' threw an exception.

I am facing this issue for both python 3.11 and 3.12 versions.

Has anyone faced this issue or help me debug this issue?

Activity

  1. RatmmmhSquishyRat commented on Mar 28, 2025

    @RatmmmhSquishyRat
  2. locked and limited conversation to collaborators on Apr 11, 2025
  3. converted this issue into a discussion #2577 on Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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