Open Barabazs opened 12 months ago
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...
AttributeError: type object 'Signature' has no attribute '_encoding'
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
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()
EDIT: added code to reproduce the error
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