Skip to content

TypeError: Protocols cannot be instantiated #1332

Open
@jessielaf

Description

@jessielaf

I am having a issue with getting the date from a git commit. I keep getting this error:

Traceback (most recent call last):
  File "/code/manage.py", line 19, in <module>
    main()
  File "/code/manage.py", line 15, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/code/commits/management/commands/scan_commits.py", line 35, in handle
    self.create_commits_branch(project, branch)
  File "/code/commits/management/commands/scan_commits.py", line 57, in create_commits_branch
    date=datetime.fromtimestamp(git_commit.committed_date),
  File "/usr/local/lib/python3.9/site-packages/gitdb/util.py", line 253, in __getattr__
    self._set_cache_(attr)
  File "/usr/local/lib/python3.9/site-packages/git/objects/commit.py", line 199, in _set_cache_
    self._deserialize(BytesIO(stream.read()))
  File "/usr/local/lib/python3.9/site-packages/git/objects/commit.py", line 528, in _deserialize
    self.tree = Tree(self.repo, hex_to_bin(readline().split()[1]), Tree.tree_id << 12, '')
  File "/usr/local/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/usr/local/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/usr/local/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/local/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated

I get this error with the python 3.9 in docker. Using version 3.1.20 of GitPython.

Metadata

Metadata

Assignees

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