Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: type object Signature has no attribute _encoding #1224

Open
Barabazs opened this issue Jul 4, 2023 · 1 comment
Open

AttributeError: type object Signature has no attribute _encoding #1224

Barabazs opened this issue Jul 4, 2023 · 1 comment

Comments

@Barabazs
Copy link

Barabazs commented Jul 4, 2023

Hi folks!

I'm running into this weird error when running my python code with ray.
Basically I get AttributeError: type object 'Signature' has no attribute '_encoding'.
But it works fine when I run my script without ray...

pygit2 version: v1.12.2
environment: python:3.9.16 docker container.

The error can be reproduced with the code below.
Ray can be installed from PyPi: pip install ray

import pygit2
import ray
from pygit2 import Signature


def function_without_ray():
    org_name = "libgit2"
    repo_name = "pygit2"
    repo = pygit2.clone_repository(
        f"https://github.com/{org_name}/{repo_name}",
        f"/tmp/{repo_name}.git",
    )
    new_branch = repo.branches.create(
        "dummy-branch", repo.revparse_single("HEAD")
    )
    repo.checkout(new_branch)

    index = repo.index
    index.add_all()
    index.write()

    author = Signature("John Doe", "john@doe.com")

    ref = repo.head.name
    tree = index.write_tree()
    parents = [repo.head.target]

    repo.create_commit(
        ref,
        author,
        author,
        "Just a dummy commit",
        tree,
        parents,
    )


@ray.remote
def function_with_ray():
    function_without_ray()

# Comment out one of these function calls to check if it works:
ray.get(function_with_ray.remote())

function_without_ray()
@Barabazs
Copy link
Author

Barabazs commented Jul 5, 2023

EDIT: added code to reproduce the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant